from openpyxl import load_workbook
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
import numpy as np
from PyQt5.QtWidgets import QMessageBox
import logging, traceback
from exceptions import IncorrectFileStructure
import os
from scipy.interpolate import make_interp_spline
from scipy import interpolate
from classes.engine import Engine
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from expert import Expert
import shutil
from PyQt5.QtWidgets import QApplication
from matplotlib.figure import Figure
import glob
from dataExpert import Data
from statistics import mean
# from form import Form
# from output_data import TabTabl

def data_upper_lower_hmin(data, angles):
        res = [0]*2
        vals_270_90 = []
        vals_90_270 = []
        for ind, angle in enumerate(angles):
            if 0<=angle<90 or 270<angle<450:
                vals_270_90.append(data[ind])
            else:
                vals_90_270.append(data[ind])
        if not vals_270_90 == []:
            res[0] = min(vals_270_90)
        if not vals_90_270 == []:
            res[1] = min(vals_90_270)
        return res

def data_upper_lower_dm(data, angles):
        res = [0]*2
        vals_270_90 = []
        vals_90_270 = []
        for ind, angle in enumerate(angles):
            if 0<=angle<90 or 270<angle<450:
                vals_270_90.append(data[ind])
            else:
                vals_90_270.append(data[ind])
        if not vals_270_90 == []:
            res[0] = max(vals_270_90)
        if not vals_90_270 == []:
            res[1] = max(vals_90_270)
        return res

class Excel:
    def __init__(self, path: str):
        self.file = load_workbook(path)

    def _write(self, obj, code_column: str, sheet: str):
        ws = self.file.get_sheet_by_name(sheet)
        column = ws[code_column]
        for col in column:
            if col.value is not None:
                ws.cell(row=col.row, column=col.col_idx+1).value = obj[col.value]
       
    def one(self, obj) -> None:
        self._write(obj, 'G', '1')
    
    def second(self, obj) -> None:
        self._write(obj, 'C', '2')


    def third(self, obj) -> None:
        self._write(obj, 'G', '3')


    def fourth(self, obj) -> None:
        ws = self.file.get_sheet_by_name('4')
        ws.cell(row=1, column=4).value = obj.nm
        ws.cell(row=2, column=4).value = obj.self.dsch
        ws.cell(row=3, column=4).value = obj.self.dkor
        ws.cell(row=4, column=4).value = obj.self.bsch
        ws.cell(row=5, column=4).value = obj.self.BKOR1
        ws.cell(row=6, column=4).value = obj.self.BKOR2
        ws.cell(row=7, column=4).value = obj.bkro3
        ws.cell(row=8, column=4).value = obj.self.BKOR4
        ws.cell(row=9, column=4).value = obj.self.BKOR5
        ws.cell(row=10, column=4).value = obj.bkor6
        ws.cell(row=11, column=4).value = obj.bkor7
        ws.cell(row=12, column=4).value = obj.self.BKAN1
        ws.cell(row=13, column=4).value = obj.self.BKAN2
        ws.cell(row=14, column=4).value = obj.self.BKAN3
        ws.cell(row=15, column=4).value = obj.self.BKAN4
        ws.cell(row=16, column=4).value = obj.self.BKAN5
        ws.cell(row=17, column=4).value = obj.bkan6
        ws.cell(row=18, column=4).value = obj.bkan7

        ws.cell(row=33, column=4).value = obj.self.TVX
        ws.cell(row=34, column=4).value = obj.self.d0

        ws.cell(row=40, column=4).value = obj.self.PM1
        ws.cell(row=41, column=4).value = obj.ssch
        ws.cell(row=42, column=4).value = obj.self.SKOR 
        ws.cell(row=43, column=4).value = obj.self.lw
        ws.cell(row=44, column=4).value = obj.self.SSCHT
        ws.cell(row=45, column=4).value = obj.self.SKOR
        ws.cell(row=46, column=4).value = obj.nw
        ws.cell(row=47, column=4).value = obj.ms
        ws.cell(row=48, column=4).value = obj.self.fks
        ws.cell(row=49, column=4).value = obj.self.fkk
        ws.cell(row=50, column=4).value = obj.r
        ws.cell(row=51, column=4).value = obj.l
        ws.cell(row=52, column=4).value = obj.cil
    def ParseFromFile(self):
        table = ['1', 'B']
        arr = []
        ws = self.file.get_sheet_by_name(table[0])
        for i in range(1, 721):
            arr.append(ws.cell(row=i+1, column=2).value)
        return arr
    def ParseToFile(self, arr, path):
        table_index = [2, 10]
        table = [['1', 'B'], ['2', 'J']]
        file = load_workbook(path)
        for j in range(len(table)):
          ws = file.get_sheet_by_name(table[j][0])
          for i in range(0, 720):
            ws.cell(row=i+2, column=table_index[j]).value = float(arr[i])
        file.save(path)
class ReadExcel:
    def __init__(self, path):
        self.file = load_workbook(path)

    def getEngine(self) -> str:
        ''' Получение движка из excel файла '''
        try:
            sheet = self.file.get_sheet_by_name('3')
        except Exception:
            raise IncorrectFileStructure
        if sheet["E26"].value is None or \
                'Engine model' not in sheet["E26"].value:
            raise IncorrectFileStructure
        return sheet["H26"].value

    def getAllLists(self):
        return self.getOneList() | self.getSecondList() | self.getThirdList() | self.getFourthList()
    def getModeParam(self):
      d = {}
      if self.getOneList()['pz1'] != None:
        d['pz1'] = self.getOneList()['pz1']
      if self.getOneList()['pz2'] != None:
       d['pz2'] = self.getOneList()['pz2']
      if self.getOneList()['pn1'] != None:
       d['pn1'] = self.getOneList()['pn1']
      if self.getOneList()['pn2'] != None:
       d['pn2'] = self.getOneList()['pn2']
      if self.getFourthList()['nm'] != None:
       d['nm'] = self.getFourthList()['nm']
      if self.getSecondList()['nn'] != None:
       d['nn'] = self.getSecondList()['nn']
      if self.getFourthList()['pm1'] != None:
       d['pm1'] = self.getFourthList()['pm1']
      return d
    def getOneList(self) -> dict:
        ws = self.file.get_sheet_by_name('1')
        res = dict()
        column = ws['F']
        for col in column:
            if col.value is not None:
                res[str(col.value).strip()] = ws.cell(row=col.row, column=col.col_idx+1).value
        return res

    def getSecondList(self) -> dict:
        ws = self.file.get_sheet_by_name('2')
        res = dict()
        column = ws['A']
        for col in column:
            if col.value is not None:
                res[str(col.value).strip()] = ws.cell(row=col.row, column=col.col_idx+2).value
        return res

    def getThirdList(self) -> dict:
        ws = self.file.get_sheet_by_name('3')
        res = dict()
        column = ws['G']
        for col in column:
            if col.value is not None:
                if col.value == 'Armfoce1':
                  res['Armforce1'] = ws.cell(row=col.row, column=col.col_idx+1).value
                elif col.value == 'Armfoce2':
                  res['Armforce2'] = ws.cell(row=col.row, column=col.col_idx+1).value
                else:
                  res[str(col.value).strip()] = ws.cell(row=col.row, column=col.col_idx+1).value
        return res

    def getFourthList(self) -> dict:
        ws = self.file.get_sheet_by_name('4')
        res = dict()
        column = ws['C']
        for col in column:
            if col.value is not None:
                if col.value == "cil":
                    pass
                else:
                    res[str(col.value).strip()] = ws.cell(row=col.row, column=col.col_idx+1).value
        return res
    
    def updateCell(self, name, value, file):
      tables = [['1', 'F'], ['2', 'A'], ['3', 'G'], ['4', 'C']]
      for table in tables:
        ws = self.file.get_sheet_by_name(table[0])
        column = ws[table[1]]
        for col in column:
            if col.value is not None:
              name = self.valid(name)
              if self.compare(col.value, name):
                  if table[0] == '2':
                    try:
                      mycell = ws.cell(row=col.row, column=col.col_idx+2).value = float(value)
                    except:
                       pass
                  else:
                    try:
                      mycell = ws.cell(row=col.row, column=col.col_idx+1).value = float(value)
                    except:
                       pass
      self.file.save(file)
      self.file.close()

    def compare(self, a, b):
      try:
        return a.strip() == b
      except:
        return a == b
      
    def valid(self, string):
      match string:
        case "Armforce1":
          return "Armfoce1"
        case "Armforce2":
          return "Armfoce2"
        case _:
          return string

    def _get(self, sheet:str, column_code: str) -> list:
        ws = self.file.get_sheet_by_name(sheet)
        res = list()
        column = ws[column_code]
        for i in range(1, len(column)):
            if column[i].value is not None:
                res.append(column[i].value)
            else:
                break
        return res
    
    # def _getCells(self, sheet:str, column_code: str) -> list:
    #   ws = self.file.get_sheet_by_name(sheet)
    #   res = list()
    #   column = ws[column_code]
    #   for i in range(735, len(column)):
    #         if column[i].value is not None:
    #             res.append(ws.cell(row=i, column=column[i].col_idx).value)
    #         else:
    #             break
    #   return res

    def getFMAX(self) -> list:
       return self._getCells('4', 'BH')

    def getPIND(self)-> list:
        return self._get('1', 'B')

    def getFX(self) -> list:
        return self._get('2', 'K')

    def getFY(self) -> list:
        return self._get('2', 'L')

    def getFSUM(self) -> list:
        return self._get('2', 'M')

    def getBETA(self) -> list:
        return self._get('2', 'N')

    def getGAM(self) -> list:
        return self._get('2', 'O')

    def getPXZ(self) -> list:
        return self._get('2', 'Q')

    def getPYZ(self) -> list:
        return self._get('2', 'R')

    def getFX1(self) -> list:
        return self._get('3', 'L')

    def getFYK1(self) -> list:
        return self._get('3', 'M')
    
    def getFSUM1(self) -> list:
        return self._get('3', 'N')

    def getBETA1(self) -> list:
        return self._get('3', 'O')

    def getGAM1(self) -> list:
        return self._get('3', 'P')

    def getFXK2(self) -> list:
        return self._get('3', 'Q')

    def getFYK2(self) -> list:
        return self._get('3', 'R')

    def getFSUM2(self) -> list:
        return self._get('3', 'S')

    def getBETA2(self) -> list:
        return self._get('3', 'T')

    def getGAM2(self) -> list:
        return self._get('3', 'U')

    def getFXK3(self) -> list:
        return self._get('3', 'V')

    def getFYK3(self) -> list:
        return self._get('3', 'W')

    def getFSUM3(self) -> list:
        return self._get('3', 'X')

    def getBETA3(self) -> list:
        return self._get('3', 'Y')

    def getGAM3(self) -> list:
        return self._get('3', 'Z')

    def getFXK4(self) -> list:
        return self._get('3', 'AA')

    def getFYK4(self) -> list:
        return self._get('3', 'AB')

    def getFSUM4(self) -> list:
        return self._get('3', 'AC')

    def getBETA4(self) -> list:
        return self._get('3', 'AD')

    def getGAM4(self) -> list:
        return self._get('3', 'AE')

    def getFXK5(self) -> list:
        return self._get('3', 'AF')

    def getFYK5(self) -> list:
        return self._get('3', 'AG')

    def getFSUM5(self) -> list:
        return self._get('3', 'AH')

    def getBETA5(self) -> list:
        return self._get('3', 'AI')

    def getGAM5(self) -> list:
        return self._get('3', 'AJ')

    def getFXK6(self) -> list:
        return self._get('3', 'AK')

    def getFYK6(self) -> list:
        return self._get('3', 'AL')

    def getFSUM6(self) -> list:
        return self._get('3', 'AM')

    def getBETA6(self) -> list:
        return self._get('3', 'AN')

    def getGAM6(self) -> list:
        return self._get('3', 'AO')

    def getFXK7(self) -> list:
        return self._get('3', 'AP')

    def getFYK7(self) -> list:
        return self._get('3', 'AQ')

    def getFSUM7(self) -> list:
        return self._get('3', 'AR')

    def getBETA7(self) -> list:
        return self._get('3', 'AS')

    def getGAM7(self) -> list:
        return self._get('3', 'AT')
    
    def PSUM(self) -> list:
        return self._get('4', 'BH')
    
    def PSUM1(self) -> list:
        return self._get('4', 'BI')
    
    def PSUM2(self) -> list:
        return self._get('4', 'BJ')
    
    def PSUM3(self) -> list:
        return self._get('4', 'BK')
    
    def PSUM4(self) -> list:
        return self._get('4', 'BL')
    
    def PSUM5(self) -> list:
       return self._get('4', 'BM')
    
    def PSUM6(self) -> list:
       return self._get('4', 'BN')
    
    def PSUM7(self) -> list:
       return self._get('4', 'BO')

    def xg(self) -> list:
        return self._get('4', 'BY')
    
    def yg(self) -> list:
        return self._get('4', 'BZ')

    def xq(self) -> list:
        return self._get('4', 'CA')
    
    def yq(self) ->list:
        return self._get('4', 'CB')
    
    def hmin(self) -> list:
        return self._get('4', 'CC')
    
    def FHMIN(self) -> list:
      return self._get('4', 'CD')
    
    def xg1(self) -> list:
        return self._get('4', 'CG')
    
    def yg1(self) -> list:
        return self._get('4', 'CH')
    
    def xq1(self) -> list:
        return self._get('4', 'CI')
    
    def yq1(self) -> list:
        return self._get('4', 'CJ')
    
    def hmin1(self) -> list:
        return self._get('4', 'CK')
    
    def FHMIN1(self) -> list:
      return self._get('4', 'CL')
    
    def xg2(self) -> list:
        return self._get('4', 'CN')
    
    def yg2(self) -> list:
        return self._get('4', 'CO')
    
    def xq2(self) -> list:
        return self._get('4', 'CP')
    
    def yq2(self) -> list:
        return self._get('4', 'CQ')
    
    def hmin2(self) -> list:
        return self._get('4', 'CR')
    
    def FHMIN2(self) -> list:
      return self._get('4', 'CS')
    
    def xg3(self) -> list:
        return self._get('4', 'CU')
    
    def yg3(self) -> list:
        return self._get('4', 'CV')
    
    def xq3(self) -> list:
        return self._get('4', 'CW')
    
    def yq3(self) -> list:
        return self._get('4', 'CX')
    
    def hmin3(self) -> list:
        return self._get('4', 'CY')
    
    def FHMIN3(self) -> list:
      return self._get('4', 'CZ')
    
    def xg4(self) -> list:
        return self._get('4', 'DB')
    
    def yg4(self) -> list:
        return self._get('4', 'DC')
    
    def xq4(self) -> list:
        return self._get('4', 'DD')
    
    def yq4(self) -> list:
        return self._get('4', 'DE')
    
    def hmin4(self) -> list:
        return self._get('4', 'DF')
    
    def FHMIN4(self) -> list:
      return self._get('4', 'DG')
    
    def xg5(self) -> list:
       return self._get('4', 'DI')
    
    def yg5(self) -> list:
       return self._get('4', 'DJ')
    
    def xq5(self) -> list:
      return self._get('4', 'DK')
    
    def yq5(self) -> list:
       return self._get('4', 'DL')
    
    def hmin5(self) -> list:
       return self._get('4', 'DM')
    
    def FHMIN5(self) -> list:
      return self._get('4', 'DN')

    def xg6(self) -> list:
       return self._get('4', 'DP')
    
    def yg6(self) -> list:
       return self._get('4', 'DQ')
    
    def xq6(self) -> list:
      return self._get('4', 'DR')
    
    def yq6(self) -> list:
       return self._get('4', 'DS')
    
    def hmin6(self) -> list:
       return self._get('4', 'DT')
    
    def FHMIN6(self) -> list:
      return self._get('4', 'DU')
    
    def xg7(self) -> list:
       return self._get('4', 'DW')
    
    def yg7(self) -> list:
       return self._get('4', 'DX')
    
    def xq7(self) -> list:
      return self._get('4', 'DY')
    
    def yq7(self) -> list:
       return self._get('4', 'DZ')
    
    def hmin7(self) -> list:
       return self._get('4', 'EA')

    def FHMIN7(self) -> list:
      return self._get('4', 'EB')
    
    def ugm(self) -> list:
        return self._get('4', 'ED')
    
    def ugw(self) -> list:
        return self._get('4', 'EE')
    
    def ugm1(self) -> list:
        return self._get('4', 'EG')
    
    def ugw1(self) -> list:
        return self._get('4', 'EH')
    
    def ugm2(self) -> list:
        return self._get('4', 'EJ')

    def ugw2(self) -> list:
        return self._get('4', 'EK')
    
    def ugm3(self) -> list:
        return self._get('4', 'EM')
    
    def ugw3(self) -> list:
        return self._get('4', 'EN')
    
    def ugm4(self) -> list:
        return self._get('4', 'EP')
    
    def ugw4(self) -> list:
        return self._get('4', 'EQ')
    
    def ugm5(self) -> list:
        return self._get('4', 'ES')
    
    def ugw5(self) -> list:
        return self._get('4', 'ET')
    
    def ugm6(self) -> list:
        return self._get('4', 'EV')
    
    def ugw6(self) -> list:
        return self._get('4', 'EW')
    
    def ugm7(self) -> list:
        return self._get('4', 'EY')
    
    def ugw7(self) -> list:
        return self._get('4', 'EZ')
    
    def dm(self) -> list:
       return self._get('4', 'EC')
    
    def dm1(self) -> list:
       return self._get('4', 'EF')
    
    def dm2(self) -> list:
       return self._get('4', 'EI')
    
    def dm3(self) -> list:
       return self._get('4', 'EL')
    
    def dm4(self) -> list:
       return self._get('4', 'EO')
    
    def dm5(self) -> list:
       return self._get('4', 'ER')
    
    def dm6(self) -> list:
       return self._get('4', 'EU')
    
    def dm7(self) -> list:
       return self._get('4', 'EX')
    
    def FFT_bearing(self) -> list:
       return self._get('5', 'FO')
    
    def FFT1_bearing(self) -> list:
       return self._get('5', 'FP')
    
    def FFT2_bearing(self) -> list:
       return self._get('5', 'FQ')
    
    def FFT3_bearing(self) -> list:
       return self._get('5', 'FR')
    
    def FFT4_bearing(self) -> list:
       return self._get('5', 'FS')
    
    def FFT5_bearing(self) -> list:
       return self._get('5', 'FT')
    
    def FFT6_bearing(self) -> list:
       return self._get('5', 'FU')
    
    def FFT7_bearing(self) -> list:
       return self._get('5', 'FV')
    
    def FFT_shaft(self) -> list:
       return self._get('5', 'FY')
    
    def FFT1_shaft(self) -> list:
       return self._get('5', 'FZ')
    
    def FFT2_shaft(self) -> list:
       return self._get('5', 'GA')
    
    def FFT3_shaft(self) -> list:
       return self._get('5', 'GB')
    
    def FFT4_shaft(self) -> list:
       return self._get('5', 'GC')
    
    def FFT5_shaft(self) -> list:
       return self._get('5', 'GD')
    
    def FFT6_shaft(self) -> list:
       return self._get('5', 'GE')
    
    def FFT7_shaft(self) -> list:
       return self._get('5', 'GF')
    
    def TN(self) -> list:
       return self._get('5', 'FF')
    
    def TN1(self) -> list:
       return self._get('5', 'FG')
    
    def TN2(self) -> list:
       return self._get('5', 'FH')
    
    def TN3(self) -> list:
       return self._get('5', 'FI')
    
    def TN4(self) -> list:
       return self._get('5', 'FJ')
    
    def TN5(self) -> list:
       return self._get('5', 'FK')
    
    def TN6(self) -> list:
       return self._get('5', 'FL')
    
    def TN7(self) -> list:
       return self._get('5', 'FM')

    def FMAX_base(self) -> list:
       res = list()
       res.append(max(self.PSUM()))
       res.append(max(self.PSUM1()))
       res.append(max(self.PSUM2()))
       res.append(max(self.PSUM3()))
       res.append(max(self.PSUM4()))
       return res

    def FMAX_l4_v8(self) -> list:
      res = list()
      res += self.FMAX_base()
      res.append(max(self.PSUM5()))
      return res
    
    def FMAX_l6_v12(self) -> list:
       res = list()
       res += self.FMAX_l4_v8()
       res.append(max(self.PSUM6()))
       res.append(max(self.PSUM7()))
       return res
    
    def TN_base(self) -> list:
      res = list()
      res.append(mean(self.TN()))
      res.append(mean(self.TN1()))
      res.append(mean(self.TN2()))
      res.append(mean(self.TN3()))
      res.append(mean(self.TN4()))
      return res
    
    def TN_l4_v8(self) -> list:
      res = list()
      res += self.TN_base()
      res.append(mean(self.TN5()))
      return res
    
    def TN_l6_v12(self) -> list:
      res = list()
      res += self.TN_l4_v8()
      res.append(mean(self.TN6()))
      res.append(mean(self.TN7())) 
      return res

    def dm_base(self) -> list:
       res = list()
       res.append(max(self.dm()))
       res.append(max(self.dm1()))
       res.append(max(self.dm2()))
       res.append(max(self.dm3()))
       res.append(max(self.dm4()))
       return res

    def dm_l4_v8(self) -> list:
      res = list()
      res += self.dm_base()
      res.append(max(self.dm5()))
      return res
    
    def dm_l6_v12(self) -> list:
      res = list()
      res += self.dm_l4_v8()
      res.append(max(self.dm6()))
      res.append(max(self.dm7())) 
      return res
    
    def hmin_base(self) -> list:
       res = list()
       res.append(min(self.hmin()))
       res.append(min(self.hmin1()))
       res.append(min(self.hmin2()))
       res.append(min(self.hmin3()))
       res.append(min(self.hmin4()))
       return res
    
    def hmin_l4_v8(self) -> list:
      res = list()
      res += self.hmin_base()
      res.append(min(self.hmin5()))
      return res
    
    def hmin_l6_v12(self) -> list:
      res = list()
      res += self.hmin_l4_v8()
      res.append(min(self.hmin6()))
      res.append(min(self.hmin7())) 
      return res
    
    def hmin_base_max(self) -> list:
       res = list()
       res.append(max(self.hmin()))
       res.append(max(self.hmin1()))
       res.append(max(self.hmin2()))
       res.append(max(self.hmin3()))
       res.append(max(self.hmin4()))
       return res
    
    def hmin_l4_v8_max(self) -> list:
      res = list()
      res += self.hmin_base()
      res.append(max(self.hmin5()))
      return res
    
    def hmin_l6_v12_max(self) -> list:
      res = list()
      res += self.hmin_l4_v8()
      res.append(max(self.hmin6()))
      res.append(max(self.hmin7())) 
      return res

class Table(QtWidgets.QWidget):
    def __init__(self, parent=None) -> None:
        super(Table, self).__init__()

    def add(self, data: dict[str, list[int | float]]) -> None:
        '''
            Добавление значения в таблицу
            Значения передаются в виде словаря
            key - str (Название поля. Например: FSUM, BETA, ...)
            value - list[int | float]
        '''
        self.tableWidget = QtWidgets.QTableWidget(0, len(data.keys()))
        self.tableWidget.horizontalHeader().setDefaultSectionSize(200)  
        
        vbox = QtWidgets.QVBoxLayout(self)
        self.tableWidget.setHorizontalHeaderLabels(list(data.keys()))
        max_row = self._get_max_row(data)
        self.tableWidget.setRowCount(max_row)
        column = 0
        for key, val in data.items(): 
            row = 0 
            for v in val:
                self.tableWidget.setItem(row, column, QtWidgets.QTableWidgetItem(str(v)))
                row += 1
            column+=1
        vbox.addWidget(self.tableWidget)      

    def _get_max_row(self, data: dict[str, list[int | float]]) -> int:
        '''Получает размер самого большого списка внутри словаря'''
        max_row = 0
        for key, val in data.items():
            max_row = max(max_row, len(val))
        return max_row

    def keyPressEvent(self, event) -> None:
        '''Обработчик нажатия Cntr+C'''
        self.tableWidget.keyPressEvent(event)
        if event.key() == Qt.Key.Key_C and (event.modifiers() & Qt.KeyboardModifier.ControlModifier):
            copied_cells = sorted(self.tableWidget.selectedIndexes())

            copy_text = ''
            max_column = copied_cells[-1].column() if len(copied_cells) else 0
            for c in copied_cells:
                if self.tableWidget.item(c.row(), c.column()) is None:
                    copy_text += '-'
                else:
                    copy_text += self.tableWidget.item(c.row(), c.column()).text()
                if c.column() == max_column:
                    copy_text += '\n'
                else:
                    copy_text += '\t'
                    
            QApplication.clipboard().setText(copy_text)

class TabTable(QtWidgets.QWidget):
    def __init__(self, *args, **kwargs) -> None:
        super(TabTable, self).__init__(*args, **kwargs)
        self.tabWidget = QtWidgets.QTabWidget()

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.tabWidget)

        self.setLayout(layout)

    def new_tab(self, title: str, data: dict[str, list[int | float]]) -> None:
        '''Новая вкладка в таблице'''
        index = self.tabWidget.count() - 1
        tabPage = Table(self)
        tabPage.add(data)
        self.tabWidget.insertTab(index, tabPage, title)
        self.tabWidget.setCurrentIndex(index)




class BigMainWidget(QtWidgets.QWidget):
   engine = Engine()
   def __init__(self, flag, target) -> None:
      super().__init__()
      # layout = QtWidgets.QVBoxLayout()
      # layout.addWidget(self.MainWidget)
      # self.setLayout(layout)
      # self.button = QtWidgets.QPushButton("Сдвиг по фазе на 360°")
      # self.button.clicked.connect(self.phase_shift)
      self.target = target
      self.expert = Expert()
      self.flag = flag
      self.AreChildren = flag
      self.tabWidget = QtWidgets.QTabWidget()
      self.tabWidget.setCurrentIndex(0)
      self.vbox = QtWidgets.QVBoxLayout()
      self.vbox.addWidget(self.tabWidget)
      # self.vbox.addWidget(self.button)
      self.setLayout(self.vbox)
      self.data = Data()
      self.AreTabsHere = False
      self.AreTabsHere1 = False
      self.AreTabsHere2 = False
      self.AreTabsHere3 = False
      self.AreTabsHere4 = False
      self.AreTabsHere5 = False
      self.AreTabsHere6 = False
      self.AreTabsHere7 = False
      self.AreTabsHere8 = False
      self.AreTabsHere9 = False
      self.AreTabsHere10 = False
      self.AreTabsHere11 = False
      self.AreTabsHere12 = False
      self.AreTabsHere13 = False
      self.AreTabsHere14 = False
      self.AreTabsHere15 = False
      self.tabWidget.currentChanged.connect(self.tabchange)

  #  def closeEvent(self, event):
  #     self.AreTabsHere = False
  #     self.AreTabsHere1 = False
  #     self.AreTabsHere2 = False
  #     self.AreTabsHere3 = False
  #     self.AreTabsHere4 = False
  #     self.AreTabsHere5 = False
  #     self.AreTabsHere6 = False
  #     self.AreTabsHere7 = False
  #     self.AreChildren = self.flag

      # tabs = self.tabWidget.count()

      # for i in range(tabs):
      #       self.tabWidget.removeTab(i)

      # event.accept()

   def enginesAdd(self, dict_excel):
      self.dict_from_excel = dict_excel
      self.dict_engine = {
          1: "L4",
          2: "L6",
          3: "V8",
          4: "L3",
          5: "V6",
          6: "V12"
      }
      self.engine = self.dict_engine[self.dict_from_excel['cil']]

   def engineAdd(self):
      self.engine = self.expert.engine_type

   def tabchange(self):
      try:
        if (self.tabWidget.widget(0).target == "common_graps_hmin"):
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:
            self.AreTabsHere = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            hmin_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(0).add_tab('hmin_common', hmin_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[0])

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[0])

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin(), excel.FHMIN())[0])

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew, 'Oil Film Thickness')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew, 'Oil Film Thickness')
              hmin_common.graphic.sc.axes.legend(['hmin_min', 'Lower', 'hmin_max', 'Upper'])
            else:
              hmin_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo", 'Oil Film Thickness')
              hmin_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro", 'Oil Film Thickness')
              hmin_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            hmin_common.table.new_tab(
                "Oil Film Thickness",
                { 
                    "Режим": modes,
                    "Обороты": x_list,
                    "hmin_max": y_list_max,
                    "hmin_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            self.AreTabsHere1 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            hmin1_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(1).add_tab('hmin1_common', hmin1_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[0])

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[0])

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin1(), excel.FHMIN1())[0])

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin1_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew, 'Oil Film Thickness')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin1_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew, 'Oil Film Thickness')
              hmin1_common.graphic.sc.axes.legend(['hmin1_min', 'Lower', 'hmin1_max', 'Upper'])
            else:
              hmin1_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo", 'Oil Film Thickness')
              hmin1_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro", 'Oil Film Thickness')
              hmin1_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            hmin1_common.table.new_tab(
                "Oil Film Thickness",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "hmin1_max": y_list_max,
                    "hmin1_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            self.AreTabsHere2 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            hmin2_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(2).add_tab('hmin2_common', hmin2_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[0])

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[0])

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin2(), excel.FHMIN2())[0])

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin2_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew, 'Oil Film Thickness')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin2_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew, 'Oil Film Thickness')
              hmin2_common.graphic.sc.axes.legend(['hmin2_min', 'Lower', 'hmin2_max', 'Upper'])
            else:
              hmin2_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo", 'Oil Film Thickness')
              hmin2_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro", 'Oil Film Thickness')
              hmin2_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            hmin2_common.table.new_tab(
                "Oil Film Thickness",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "hmin2_max": y_list_max,
                    "hmin2_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            self.AreTabsHere3 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            hmin3_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(3).add_tab('hmin3_common', hmin3_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[0])

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[0])

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin3(), excel.FHMIN3())[0])

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin3_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew, 'Oil Film Thickness')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin3_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew, 'Oil Film Thickness')
              hmin3_common.graphic.sc.axes.legend(['hmin3_min', 'Lower', 'hmin3_max', 'Upper'])
            else:
              hmin3_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo", 'Oil Film Thickness')
              hmin3_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro", 'Oil Film Thickness')
              hmin3_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            hmin3_common.table.new_tab(
                "Oil Film Thickness",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "hmin3_max": y_list_max,
                    "hmin3_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            self.AreTabsHere4 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            hmin4_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(4).add_tab('hmin4_common', hmin4_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[0])

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[0])

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[1])
                y_list_max.append(data_upper_lower_hmin(excel.hmin4(), excel.FHMIN4())[0])

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin4_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew, 'Oil Film Thickness')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              hmin4_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew, 'Oil Film Thickness')
              hmin4_common.graphic.sc.axes.legend(['hmin4_min', 'Lower', 'hmin4_max', 'Upper'])
            else:
              hmin4_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'Oil Film Thickness')
              hmin4_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro", 'Oil Film Thickness')
              hmin4_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            hmin4_common.table.new_tab(
                "Oil Film Thickness",
                {
                    "Режим": modes,
                    "Обороты": x_list,
                    "hmin4_max": y_list_max,
                    "hmin4_min": y_list_min
                },
            )

        print(f'self.engine: {self.engine}')
        print(f'self.AreTabsHere5: {self.AreTabsHere5}')
        if (self.tabWidget.currentIndex() == 5):
          print(f'self.tabWidget.widget(5).target: {self.tabWidget.widget(5).target}')

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5 
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "common_graps_hmin"):
          
          self.AreTabsHere5 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          hmin5_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(5).add_tab('hmin5_common', hmin5_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[0])

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[0])

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin5(), excel.FHMIN5())[0])

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin5_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'Oil Film Thickness')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin5_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'Oil Film Thickness')
            hmin5_common.graphic.sc.axes.legend(['hmin5_min', 'Lower', 'hmin5_max', 'Upper'])
          else:
            hmin5_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'Oil Film Thickness')
            hmin5_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'Oil Film Thickness')
            hmin5_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          hmin5_common.table.new_tab(
              "Oil Film Thickness",
              {
                  "Режим": modes,
                  "Обороты": x_list,
                  "hmin5_max": y_list_max,
                  "hmin5_min": y_list_min
              },
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "common_graps_hmin"):
          
          self.AreTabsHere6 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          hmin6_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(6).add_tab('hmin6_common', hmin6_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[0])

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[0])

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin6(), excel.FHMIN6())[0])

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin6_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'Oil Film Thickness')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin6_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'Oil Film Thickness')
            hmin6_common.graphic.sc.axes.legend(['hmin6_min', 'Lower', 'hmin6_max', 'Upper'])
          else:
            hmin6_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'Oil Film Thickness')
            hmin6_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'Oil Film Thickness')
            hmin6_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          hmin6_common.table.new_tab(
              "Oil Film Thickness",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "hmin6_max": y_list_max,
                  "hmin6_min": y_list_min
              },
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "common_graps_hmin"):
          
          self.AreTabsHere7 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          hmin7_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(7).add_tab('hmin7_common', hmin7_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[0])

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[0])

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[1])
              y_list_max.append(data_upper_lower_hmin(excel.hmin7(), excel.FHMIN7())[0])

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin7_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'Oil Film Thickness')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            hmin7_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'Oil Film Thickness')
            hmin7_common.graphic.sc.axes.legend(['hmin7_min', 'Lower', 'hmin7_max', 'Upper'])
          else:
            hmin7_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'Oil Film Thickness')
            hmin7_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'Oil Film Thickness')
            hmin7_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          hmin7_common.table.new_tab(
              "Oil Film Thickness",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "hmin7_max": y_list_max,
                  "hmin7_min": y_list_min
              },
          )

        if (self.tabWidget.widget(0).target == "common_graps_dm"):
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:
            self.AreTabsHere = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            dm_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(0).add_tab('dm_common', dm_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(min(excel.dm()))
                y_list_max.append(max(excel.dm()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(min(excel.dm()))
                y_list_max.append(max(excel.dm()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(min(excel.dm()))
                y_list_max.append(max(excel.dm()))

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
              dm_common.graphic.sc.axes.legend(['dm_min', 'Lower', 'dm_max', 'Upper'])
            else:
              dm_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
              dm_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
              dm_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            dm_common.table.new_tab(
                "OIL FILM PRESSURE",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "dm_max": y_list_max,
                    "dm_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            self.AreTabsHere1 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            dm1_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(1).add_tab('dm1_common', dm1_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(min(excel.dm1()))
                y_list_max.append(max(excel.dm1()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(min(excel.dm1()))
                y_list_max.append(max(excel.dm1()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(min(excel.dm1()))
                y_list_max.append(max(excel.dm1()))

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm1_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm1_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
              dm1_common.graphic.sc.axes.legend(['dm1_min', 'Lower', 'dm1_max', 'Upper'])
            else:
              dm1_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
              dm1_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
              dm1_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            dm1_common.table.new_tab(
                "OIL FILM PRESSURE",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "dm1_max": y_list_max,
                    "dm1_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            self.AreTabsHere2 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            dm2_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(2).add_tab('dm2_common', dm2_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(min(excel.dm2()))
                y_list_max.append(max(excel.dm2()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(min(excel.dm2()))
                y_list_max.append(max(excel.dm2()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(min(excel.dm2()))
                y_list_max.append(max(excel.dm2()))

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm2_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm2_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
              dm2_common.graphic.sc.axes.legend(['dm2_min', 'Lower', 'dm2_max', 'Upper'])
            else:
              dm2_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
              dm2_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
              dm2_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            dm2_common.table.new_tab(
                "OIL FILM PRESSURE",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "dm2_max": y_list_max,
                    "dm2_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            self.AreTabsHere3 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            dm3_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(3).add_tab('dm3_common', dm3_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(min(excel.dm3()))
                y_list_max.append(max(excel.dm3()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(min(excel.dm3()))
                y_list_max.append(max(excel.dm3()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(min(excel.dm3()))
                y_list_max.append(max(excel.dm3()))

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm3_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm3_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
              dm3_common.graphic.sc.axes.legend(['dm3_min', 'Lower', 'dm3_max', 'Upper'])
            else:
              dm3_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
              dm3_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
              dm3_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            dm3_common.table.new_tab(
                "OIL FILM PRESSURE",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "dm3_max": y_list_max,
                    "dm3_min": y_list_min
                },
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            self.AreTabsHere4 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            dm4_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(4).add_tab('dm4_common', dm4_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_min = list()
            y_list_max = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_min.append(min(excel.dm4()))
                y_list_max.append(max(excel.dm4()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_min.append(min(excel.dm4()))
                y_list_max.append(max(excel.dm4()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_min.append(min(excel.dm4()))
                y_list_max.append(max(excel.dm4()))

            x_list_new = sorted(x_list)
            y_list_min_new = list()
            y_list_max_new = list()
            for i in range(len(list_)):
              y_list_min_new.append(y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(y_list_max[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm4_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

              tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              dm4_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
              dm4_common.graphic.sc.axes.legend(['dm4_min', 'Lower', 'dm4_max', 'Upper'])
            else:
              dm4_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
              dm4_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
              dm4_common.graphic.sc.axes.legend(['Lower', 'Upper'])

            dm4_common.table.new_tab(
                "OIL FILM PRESSURE",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "dm4_max": y_list_max,
                    "dm4_min": y_list_min
                },
            )
        
        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5 
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "common_graps_dm"):
          
          self.AreTabsHere5 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          dm5_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(5).add_tab('dm5_common', dm5_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(min(excel.dm5()))
              y_list_max.append(max(excel.dm5()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(min(excel.dm5()))
              y_list_max.append(max(excel.dm5()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(min(excel.dm5()))
              y_list_max.append(max(excel.dm5()))

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm5_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm5_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
            dm5_common.graphic.sc.axes.legend(['dm5_min', 'Lower', 'dm5_max', 'Upper'])
          else:
            dm5_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
            dm5_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
            dm5_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          dm5_common.table.new_tab(
              "OIL FILM PRESSURE", 
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "dm5_max": y_list_max,
                  "dm5_min": y_list_min
              },
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "common_graps_dm"):
          
          self.AreTabsHere6 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          dm6_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(6).add_tab('dm6_common', dm6_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(min(excel.dm6()))
              y_list_max.append(max(excel.dm6()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(min(excel.dm6()))
              y_list_max.append(max(excel.dm6()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(min(excel.dm6()))
              y_list_max.append(max(excel.dm6()))

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm6_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm6_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
            dm6_common.graphic.sc.axes.legend(['dm6_min', 'Lower', 'dm6_max', 'Upper'])
          else:
            dm6_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
            dm6_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
            dm6_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          dm6_common.table.new_tab(
              "OIL FILM PRESSURE",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "dm6_max": y_list_max,
                  "dm6_min": y_list_min
              },
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "common_graps_dm"):
          
          self.AreTabsHere7 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          dm7_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(7).add_tab('dm7_common', dm7_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_min = list()
          y_list_max = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_min.append(min(excel.dm7()))
              y_list_max.append(max(excel.dm7()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_min.append(min(excel.dm7()))
              y_list_max.append(max(excel.dm7()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_min.append(min(excel.dm7()))
              y_list_max.append(max(excel.dm7()))

          x_list_new = sorted(x_list)
          y_list_min_new = list()
          y_list_max_new = list()
          for i in range(len(list_)):
              y_list_min_new.append(1000*y_list_min[x_list.index(x_list_new[i])])
              y_list_max_new.append(1000*y_list_max[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_min_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm7_common.graphic.set_point(x_list_new, y_list_min_new, "o", xnew, ynew,'OIL FILM PRESSURE')

            tck,u     = interpolate.splprep( [x_list_new, y_list_max_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            dm7_common.graphic.set_point(x_list_new, y_list_max_new, "o", xnew, ynew,'OIL FILM PRESSURE')
            dm7_common.graphic.sc.axes.legend(['dm7_min', 'Lower', 'dm7_max', 'Upper'])
          else:
            dm7_common.graphic.set_point1(x_list_new, y_list_min_new, "-bo",'OIL FILM PRESSURE')
            dm7_common.graphic.set_point1(x_list_new, y_list_max_new, "-ro",'OIL FILM PRESSURE')
            dm7_common.graphic.sc.axes.legend(['Lower', 'Upper'])

          dm7_common.table.new_tab(
              "OIL FILM PRESSURE",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "dm7_max": y_list_max,
                  "dm7_min": y_list_min
              },
          )

        if (self.tabWidget.widget(0).target == "common_graps_loss"):
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:
            self.AreTabsHere = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            TN_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(0).add_tab('TN_common', TN_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_average = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_average.append(mean(excel.TN()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_average.append(mean(excel.TN()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_average.append(mean(excel.TN()))

            x_list_new = sorted(x_list)
            y_list_average_new = list()
            for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              TN_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

              TN_common.graphic.sc.axes.legend(['TN_average', 'Average'])
            else:
              TN_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
              TN_common.graphic.sc.axes.legend(['Average'])

            TN_common.table.new_tab(
                "POWER LOSS",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "TN_average": y_list_average,
                },
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            self.AreTabsHere1 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            TN1_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(1).add_tab('TN1_common', TN1_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_average = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_average.append(mean(excel.TN1()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_average.append(mean(excel.TN1()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_average.append(mean(excel.TN1()))

            x_list_new = sorted(x_list)
            y_list_average_new = list()
            for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              TN1_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

              TN1_common.graphic.sc.axes.legend(['TN1_average', 'Average'])
            else:
              TN1_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
              TN1_common.graphic.sc.axes.legend(['Average'])

            TN1_common.table.new_tab(
                "POWER LOSS",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "TN1_average": y_list_average,
                },
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            self.AreTabsHere2 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            TN2_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(2).add_tab('TN2_common', TN2_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_average = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_average.append(mean(excel.TN2()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_average.append(mean(excel.TN2()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_average.append(mean(excel.TN2()))

            x_list_new = sorted(x_list)
            y_list_average_new = list()
            for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              TN2_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

              TN2_common.graphic.sc.axes.legend(['TN2_average', 'Average'])
            else:
              TN2_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
              TN2_common.graphic.sc.axes.legend(['Average'])

            TN2_common.table.new_tab(
                "POWER LOSS",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "TN2_average": y_list_average,
                },
            )
          
          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            self.AreTabsHere3 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            TN3_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(3).add_tab('TN3_common', TN3_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_average = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_average.append(mean(excel.TN3()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_average.append(mean(excel.TN3()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_average.append(mean(excel.TN3()))

            x_list_new = sorted(x_list)
            y_list_average_new = list()
            for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              TN3_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

              TN3_common.graphic.sc.axes.legend(['TN3_average', 'Average'])
            else:
              TN3_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
              TN3_common.graphic.sc.axes.legend(['Average'])

            TN3_common.table.new_tab(
                "POWER LOSS",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "TN3_average": y_list_average,
                },
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            self.AreTabsHere4 = True

            grap = Graphics(self.expert.paths_to_res[0], 1)
            TN4_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
            self.tabWidget.widget(4).add_tab('TN4_common', TN4_common)

            list_ = list()
            list_.extend(set(self.expert.paths_to_res))
            x_list = list()
            y_list_average = list()
            modes = list()

            for i in range(len(list_)):
              excel = ReadExcel(list_[i])
              if "mode1" in list_[i]:
                x_list.append(int(self.expert.dict_mode1['nn']))
                modes.append(1)
                y_list_average.append(mean(excel.TN4()))

              elif "mode2" in list_[i]:
                x_list.append(int(self.expert.dict_mode2['nn']))
                modes.append(2)
                y_list_average.append(mean(excel.TN4()))

              elif "mode3" in list_[i]:
                x_list.append(int(self.expert.dict_mode3['nn']))
                modes.append(3)
                y_list_average.append(mean(excel.TN4()))

            x_list_new = sorted(x_list)
            y_list_average_new = list()
            for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

            if len(list_) == 3:
              tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
              xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
              TN4_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

              TN4_common.graphic.sc.axes.legend(['TN4_average', 'Average'])
            else:
              TN4_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
              TN4_common.graphic.sc.axes.legend(['Average'])

            TN4_common.table.new_tab(
                "POWER LOSS",
                {   
                    "Режим": modes,
                    "Обороты": x_list,
                    "TN4_average": y_list_average,
                },
            )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5 
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "common_graps_loss"):

          self.AreTabsHere5 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          TN5_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(5).add_tab('TN5_common', TN5_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_average = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_average.append(mean(excel.TN5()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_average.append(mean(excel.TN5()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_average.append(mean(excel.TN5()))

          x_list_new = sorted(x_list)
          y_list_average_new = list()
          for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            TN5_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

            TN5_common.graphic.sc.axes.legend(['TN5_average', 'Average'])
          else:
            TN5_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
            TN5_common.graphic.sc.axes.legend(['Average'])

          TN5_common.table.new_tab(
              "POWER LOSS", 
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "TN5_average": y_list_average,
              },
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "common_graps_loss"):
          
          self.AreTabsHere6 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          TN6_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(6).add_tab('TN6_common', TN6_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_average = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_average.append(mean(excel.TN6()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_average.append(mean(excel.TN6()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_average.append(mean(excel.TN6()))

          x_list_new = sorted(x_list)
          y_list_average_new = list()
          for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            TN6_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

            TN6_common.graphic.sc.axes.legend(['TN6_average', 'Average'])
          else:
            TN6_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
            TN6_common.graphic.sc.axes.legend(['Average'])

          TN6_common.table.new_tab(
              "POWER LOSS",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "TN6_average": y_list_average,
              },
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7 
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "common_graps_loss"):
          
          self.AreTabsHere7 = True

          grap = Graphics(self.expert.paths_to_res[0], 1)
          TN7_common = MainWidget(self.expert.paths_to_res[0], 'cartesian1')
          self.tabWidget.widget(7).add_tab('TN7_common', TN7_common)

          list_ = list()
          list_.extend(set(self.expert.paths_to_res))
          x_list = list()
          y_list_average = list()
          modes = list()

          for i in range(len(list_)):
            excel = ReadExcel(list_[i])
            if "mode1" in list_[i]:
              x_list.append(int(self.expert.dict_mode1['nn']))
              modes.append(1)
              y_list_average.append(mean(excel.TN7()))

            elif "mode2" in list_[i]:
              x_list.append(int(self.expert.dict_mode2['nn']))
              modes.append(2)
              y_list_average.append(mean(excel.TN7()))

            elif "mode3" in list_[i]:
              x_list.append(int(self.expert.dict_mode3['nn']))
              modes.append(3)
              y_list_average.append(mean(excel.TN7()))

          x_list_new = sorted(x_list)
          y_list_average_new = list()
          for i in range(len(list_)):
              y_list_average_new.append(y_list_average[x_list.index(x_list_new[i])])

          if len(list_) == 3:
            tck,u     = interpolate.splprep( [x_list_new, y_list_average_new], k = 2 )
            xnew,ynew = interpolate.splev( np.linspace( 0, 1, 100 ), tck,der = 0)
            TN7_common.graphic.set_point(x_list_new, y_list_average_new, "o", xnew, ynew, 'POWER LOSS')

            TN7_common.graphic.sc.axes.legend(['TN7_average', 'Average'])
          else:
            TN7_common.graphic.set_point1(x_list_new, y_list_average_new, "-bo", 'POWER LOSS')
            TN7_common.graphic.sc.axes.legend(['Average'])

          TN7_common.table.new_tab(
              "POWER LOSS",
              {   
                  "Режим": modes,
                  "Обороты": x_list,
                  "TN7_average": y_list_average,
              },
          )

        if (self.tabWidget.widget(0).target == "forces"):
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:
            self.AreTabsHere = True
            print("mode " + str(self.expert.mode))
            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]
            grap = Graphics(self.path_to_res, 1)
            FSUM = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(0).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM)
            FSUM.graphic.FSUM_graphic()
            FSUM.graphic.remember_method(grap.FSUM_graphic)
            FSUM.table.new_tab(
                "LOAD (N)  -  CRANK ANGLE",
                {
                    "FSUM": FSUM.graphic.excel.getFSUM()
                },
            )
            FSUM.remember_tabTable("FSUM", "FSUM", FSUM.graphic.excel.getFSUM())

            BETA = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(0).add_tab('BETA', BETA)
            BETA.graphic.beta_graphic()  
            BETA.graphic.remember_method(grap.beta_graphic)
            BETA.table.new_tab(
                "BETA",
                {
                    "BETA": BETA.graphic.excel.getBETA()
                },
            )
            BETA.remember_tabTable("BETA", "BETA", BETA.graphic.excel.getBETA())

            GAM = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(0).add_tab('GAM', GAM)
            GAM.graphic.GAM_graphic()
            GAM.graphic.remember_method(grap.GAM_graphic)
            GAM.table.new_tab(
                "GAM",
                {
                    "GAM": GAM.graphic.excel.getGAM()
                }
            )
            GAM.remember_tabTable("GAM", "GAM", GAM.graphic.excel.getGAM())

            # FSUM_GAM = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(0).add_tab('FSUM_GAM', FSUM_GAM)
            # FSUM_GAM.graphic.FSUM_GAM_graphic()
            # FSUM_GAM.table.new_tab(
            #     "FSUM_GAM",
            #     {
            #         "FSUM": FSUM_GAM.graphic.excel.getFSUM(),
            #         "GAM": FSUM_GAM.graphic.excel.getGAM()
            #     }
            # )

            # FSUM_BETA = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(0).add_tab('FSUM_BETA', FSUM_BETA)
            # FSUM_BETA.graphic.FSUM_BETA_graphic()
            # FSUM_BETA.table.new_tab(
            #     "FSUM_BETA",
            #     {
            #         "FSUM": FSUM_BETA.graphic.excel.getFSUM(),
            #         "BETA": FSUM_BETA.graphic.excel.getBETA()
            #     }
            # )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            self.AreTabsHere1 = True

            FSUM1 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(1).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM1)
            FSUM1.graphic.FSUM1_graphic()
            FSUM1.graphic.remember_method(grap.FSUM1_graphic)
            FSUM1.table.new_tab(
                "LOAD (N)  -  CRANK ANGLE",
                {
                    "FSUM1": FSUM1.graphic.excel.getFSUM1()
                },
            )
            FSUM1.remember_tabTable("FSUM1", "FSUM1", FSUM1.graphic.excel.getFSUM1())

            BETA1 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(1).add_tab('BETA1', BETA1)
            BETA1.graphic.BETA1_graphic()  
            BETA1.graphic.remember_method(grap.BETA1_graphic)
            BETA1.table.new_tab(
                "BETA1",
                {
                    "BETA1": BETA1.graphic.excel.getBETA1()
                },
            )
            BETA1.remember_tabTable("BETA1", "BETA1", BETA1.graphic.excel.getBETA1())

            GAM1 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(1).add_tab('GAM1', GAM1)
            GAM1.graphic.GAM1_graphic()
            GAM1.graphic.remember_method(grap.GAM1_graphic)
            GAM1.table.new_tab(
                "GAM1",
                {
                    "GAM1": GAM1.graphic.excel.getGAM1()
                }
            )
            GAM1.remember_tabTable("GAM1", "GAM1", GAM1.graphic.excel.getGAM1())

            # FSUM1_GAM1 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(1).add_tab('FSUM1_GAM1', FSUM1_GAM1)
            # FSUM1_GAM1.graphic.FSUM1_GAM1_graphic()
            # FSUM1_GAM1.table.new_tab(
            #     "FSUM1_GAM1",
            #     {
            #         "FSUM1": FSUM1_GAM1.graphic.excel.getFSUM1(),
            #         "GAM1": FSUM1_GAM1.graphic.excel.getGAM1()
            #     }
            # )

            # FSUM1_BETA1 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(1).add_tab('FSUM1_BETA1', FSUM1_BETA1)
            # FSUM1_BETA1.graphic.FSUM1_BETA1_graphic()
            # FSUM1_BETA1.table.new_tab(
            #     "FSUM1_BETA1",
            #     {
            #         "FSUM1": FSUM1_BETA1.graphic.excel.getFSUM1(),
            #         "BETA1": FSUM1_BETA1.graphic.excel.getBETA1()
            #     }
            # )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            self.AreTabsHere2 = True

            FSUM2 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(2).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM2)
            FSUM2.graphic.FSUM2_graphic()
            FSUM2.graphic.remember_method(grap.FSUM2_graphic)
            FSUM2.table.new_tab(
                "LOAD (N)  -  CRANK ANGLE",
                {
                    "FSUM2": FSUM2.graphic.excel.getFSUM2()
                },
            )
            FSUM2.remember_tabTable("FSUM2", "FSUM2", FSUM2.graphic.excel.getFSUM2())

            BETA2 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(2).add_tab('BETA2', BETA2)
            BETA2.graphic.BETA2_graphic() 
            BETA2.graphic.remember_method(grap.BETA2_graphic) 
            BETA2.table.new_tab(
                "BETA2",
                {
                    "BETA2": BETA2.graphic.excel.getBETA2()
                },
            )
            BETA2.remember_tabTable("BETA2", "BETA2", BETA2.graphic.excel.getBETA2())

            GAM2 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(2).add_tab('GAM2', GAM2)
            GAM2.graphic.GAM2_graphic()
            GAM2.graphic.remember_method(grap.GAM2_graphic)
            GAM2.table.new_tab(
                "GAM2",
                {
                    "GAM2": GAM2.graphic.excel.getGAM2()
                }
            )
            GAM2.remember_tabTable("GAM2", "GAM2", GAM2.graphic.excel.getGAM2())

            # FSUM2_GAM2 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(2).add_tab('FSUM2_GAM2', FSUM2_GAM2)
            # FSUM2_GAM2.graphic.FSUM2_GAM2_graphic()
            # FSUM2_GAM2.table.new_tab(
            #     "FSUM2_GAM2",
            #     {
            #         "FSUM2": FSUM2_GAM2.graphic.excel.getFSUM2(),
            #         "GAM2": FSUM2_GAM2.graphic.excel.getGAM2()
            #     }
            # )

            # FSUM2_BETA2 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(2).add_tab('FSUM2_BETA2', FSUM2_BETA2)
            # FSUM2_BETA2.graphic.FSUM2_BETA2_graphic()
            # FSUM2_BETA2.table.new_tab(
            #     "FSUM2_BETA2",
            #     {
            #         "FSUM2": FSUM2_BETA2.graphic.excel.getFSUM2(),
            #         "BETA2": FSUM2_BETA2.graphic.excel.getBETA2()
            #     }
            # )

          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            self.AreTabsHere3 = True

            FSUM3 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(3).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM3)
            FSUM3.graphic.FSUM3_graphic()
            FSUM3.graphic.remember_method(grap.FSUM3_graphic)
            FSUM3.table.new_tab(
                "LOAD (N)  -  CRANK ANGLE",
                {
                    "FSUM3": FSUM3.graphic.excel.getFSUM3()
                },
            )
            FSUM3.remember_tabTable("FSUM3", "FSUM3", FSUM3.graphic.excel.getFSUM3())

            BETA3 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(3).add_tab('BETA3', BETA3)
            BETA3.graphic.BETA3_graphic()  
            BETA3.graphic.remember_method(grap.BETA3_graphic)
            BETA3.table.new_tab(
                "BETA3",
                {
                    "BETA3": BETA3.graphic.excel.getBETA3()
                },
            )
            BETA3.remember_tabTable("BETA3", "BETA3", BETA3.graphic.excel.getBETA3())

            GAM3 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(3).add_tab('GAM3', GAM3)
            GAM3.graphic.GAM3_graphic()
            GAM3.graphic.remember_method(grap.GAM3_graphic)
            GAM3.table.new_tab(
                "GAM3",
                {
                    "GAM3": GAM3.graphic.excel.getGAM3()
                }
            )
            GAM3.remember_tabTable("GAM3", "GAM3", GAM3.graphic.excel.getGAM3())

            # FSUM3_GAM3 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(3).add_tab('FSUM3_GAM3', FSUM3_GAM3)
            # FSUM3_GAM3.graphic.FSUM3_GAM3_graphic()
            # FSUM3_GAM3.table.new_tab(
            #     "FSUM3_GAM3",
            #     {
            #         "FSUM3": FSUM3_GAM3.graphic.excel.getFSUM3(),
            #         "GAM3": FSUM3_GAM3.graphic.excel.getGAM3()
            #     }
            # )

            # FSUM3_BETA3 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(3).add_tab('FSUM3_BETA3', FSUM3_BETA3)
            # FSUM3_BETA3.graphic.FSUM3_BETA3_graphic()
            # FSUM3_BETA3.table.new_tab(
            #     "FSUM3_BETA3",
            #     {
            #         "FSUM3": FSUM3_BETA3.graphic.excel.getFSUM3(),
            #         "BETA3": FSUM3_BETA3.graphic.excel.getBETA3()
            #     }
            # )
          
          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            self.AreTabsHere4 = True

            FSUM4 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(4).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM4)
            FSUM4.graphic.FSUM4_graphic()
            FSUM4.graphic.remember_method(grap.FSUM4_graphic)
            FSUM4.table.new_tab(
                "LOAD (N)  -  CRANK ANGLE",
                {
                    "FSUM4": FSUM4.graphic.excel.getFSUM4()
                },
            )
            FSUM4.remember_tabTable("FSUM4", "FSUM4", FSUM4.graphic.excel.getFSUM4())

            BETA4 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(4).add_tab('BETA4', BETA4)
            BETA4.graphic.BETA4_graphic() 
            BETA4.graphic.remember_method(grap.BETA4_graphic) 
            BETA4.table.new_tab(
                "BETA4",
                {
                    "BETA4": BETA4.graphic.excel.getBETA4()
                },
            )
            BETA4.remember_tabTable("BETA4", "BETA4", BETA4.graphic.excel.getBETA4())

            GAM4 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(4).add_tab('GAM4', GAM4)
            GAM4.graphic.GAM4_graphic()
            GAM4.graphic.remember_method(grap.GAM4_graphic)
            GAM4.table.new_tab(
                "GAM4",
                {
                    "GAM4": GAM4.graphic.excel.getGAM4()
                }
            )
            GAM4.remember_tabTable("GAM4", "GAM4", GAM4.graphic.excel.getGAM4())

            # FSUM4_GAM4 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(4).add_tab('FSUM4_GAM4', FSUM4_GAM4)
            # FSUM4_GAM4.graphic.FSUM4_GAM4_graphic()
            # FSUM4_GAM4.table.new_tab(
            #     "FSUM4_GAM4",
            #     {
            #         "FSUM4": FSUM4_GAM4.graphic.excel.getFSUM4(),
            #         "GAM4": FSUM4_GAM4.graphic.excel.getGAM4()
            #     }
            # )

            # FSUM4_BETA4 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(4).add_tab('FSUM4_BETA4', FSUM4_BETA4)
            # FSUM4_BETA4.graphic.FSUM4_BETA4_graphic()
            # FSUM4_BETA4.table.new_tab(
            #     "FSUM4_BETA4",
            #     {
            #         "FSUM4": FSUM4_BETA4.graphic.excel.getFSUM4(),
            #         "BETA4": FSUM4_BETA4.graphic.excel.getBETA4()
            #     }
            # )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5 
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "forces"):
          self.AreTabsHere5 = True

          FSUM5 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(5).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM5)
          FSUM5.graphic.FSUM5_graphic()
          FSUM5.graphic.remember_method(grap.FSUM5_graphic)
          FSUM5.table.new_tab(
              "LOAD (N)  -  CRANK ANGLE",
              {
                  "FSUM5": FSUM5.graphic.excel.getFSUM5()
              },
          )
          FSUM5.remember_tabTable("FSUM5", "FSUM5", FSUM5.graphic.excel.getFSUM5())

          BETA5 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(5).add_tab('BETA5', BETA5)
          BETA5.graphic.BETA5_graphic()  
          BETA5.graphic.remember_method(grap.BETA5_graphic)
          BETA5.table.new_tab(
              "BETA5",
              {
                  "BETA5": BETA5.graphic.excel.getBETA5()
              },
          )
          BETA5.remember_tabTable("BETA5", "BETA5", BETA5.graphic.excel.getBETA5())

          GAM5 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(5).add_tab('GAM5', GAM5)
          GAM5.graphic.GAM5_graphic()
          GAM5.graphic.remember_method(grap.GAM5_graphic)
          GAM5.table.new_tab(
              "GAM5",
              {
                  "GAM5": GAM5.graphic.excel.getGAM5()
              }
          )
          GAM5.remember_tabTable("GAM5", "GAM5", GAM5.graphic.excel.getGAM5())

          # FSUM5_GAM5 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(5).add_tab('FSUM5_GAM5', FSUM5_GAM5)
          # FSUM5_GAM5.graphic.FSUM5_GAM5_graphic()
          # FSUM5_GAM5.table.new_tab(
          #     "FSUM5_GAM5",
          #     {
          #         "FSUM5": FSUM5_GAM5.graphic.excel.getFSUM5(),
          #         "GAM5": FSUM5_GAM5.graphic.excel.getGAM5()
          #     }
          # )

          # FSUM5_BETA5 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(5).add_tab('FSUM5_BETA5', FSUM5_BETA5)
          # FSUM5_BETA5.graphic.FSUM5_BETA5_graphic()
          # FSUM5_BETA5.table.new_tab(
          #     "FSUM5_BETA5",
          #     {
          #         "FSUM5": FSUM5_BETA5.graphic.excel.getFSUM5(),
          #         "BETA5": FSUM5_BETA5.graphic.excel.getBETA5()
          #     }
          # )

        if (self.tabWidget.currentIndex() == 6
              and not self.AreTabsHere6
              and (self.engine == 'L6' or self.engine == 'V12')
              and self.tabWidget.widget(6).target == "forces"):

          self.AreTabsHere6 = True

          FSUM6 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(6).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM6)
          FSUM6.graphic.FSUM6_graphic()
          FSUM6.graphic.remember_method(grap.FSUM6_graphic)
          FSUM6.table.new_tab(
              "LOAD (N)  -  CRANK ANGLE",
              {
                  "FSUM6": FSUM6.graphic.excel.getFSUM6()
              },
          )
          FSUM6.remember_tabTable("FSUM6", "FSUM6", FSUM6.graphic.excel.getFSUM6())

          BETA6 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(6).add_tab('BETA6', BETA6)
          BETA6.graphic.BETA6_graphic() 
          BETA6.graphic.remember_method(grap.BETA6_graphic) 
          BETA6.table.new_tab(
              "BETA6",
              {
                  "BETA6": BETA6.graphic.excel.getBETA6()
              },
          )
          BETA6.remember_tabTable("BETA6", "BETA6", BETA6.graphic.excel.getBETA6())

          GAM6 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(6).add_tab('GAM6', GAM6)
          GAM6.graphic.GAM6_graphic()
          GAM6.graphic.remember_method(grap.GAM6_graphic)
          GAM6.table.new_tab(
              "GAM6",
              {
                  "GAM6": GAM6.graphic.excel.getGAM6()
              }
          )
          GAM6.remember_tabTable("GAM6", "GAM6", GAM6.graphic.excel.getGAM6())

          # FSUM6_GAM6 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(6).add_tab('FSUM6_GAM6', FSUM6_GAM6)
          # FSUM6_GAM6.graphic.FSUM6_GAM6_graphic()
          # FSUM6_GAM6.table.new_tab(
          #     "FSUM6_GAM6",
          #     {
          #         "FSUM6": FSUM6_GAM6.graphic.excel.getFSUM6(),
          #         "GAM6": FSUM6_GAM6.graphic.excel.getGAM6()
          #     }
          # )

          # FSUM6_BETA6 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(6).add_tab('FSUM6_BETA6', FSUM6_BETA6)
          # FSUM6_BETA6.graphic.FSUM6_BETA6_graphic()
          # FSUM6_BETA6.table.new_tab(
          #     "FSUM6_BETA6",
          #     {
          #         "FSUM6": FSUM6_BETA6.graphic.excel.getFSUM6(),
          #         "BETA6": FSUM6_BETA6.graphic.excel.getBETA6()
          #     }
          # )

        if (self.tabWidget.currentIndex() == 7
              and not self.AreTabsHere7
              and (self.engine == 'L6' or self.engine == 'V12')
              and self.tabWidget.widget(7).target == "forces"):
          
          self.AreTabsHere7 = True

          FSUM7 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(7).add_tab('LOAD (N)  -  CRANK ANGLE', FSUM7)
          FSUM7.graphic.FSUM7_graphic()
          FSUM7.graphic.remember_method(grap.FSUM7_graphic)
          FSUM7.table.new_tab(
              "LOAD (N)  -  CRANK ANGLE",
              {
                  "FSUM7": FSUM7.graphic.excel.getFSUM7()
              },
          )
          FSUM7.remember_tabTable("FSUM7", "FSUM7", FSUM7.graphic.excel.getFSUM7())

          BETA7 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(7).add_tab('BETA7', BETA7)
          BETA7.graphic.BETA7_graphic()  
          BETA7.graphic.remember_method(grap.BETA7_graphic)
          BETA7.table.new_tab(
              "BETA7",
              {
                  "BETA7": BETA7.graphic.excel.getBETA7()
              },
          )
          BETA7.remember_tabTable("BETA7", "BETA7", BETA7.graphic.excel.getBETA7())

          GAM7 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(7).add_tab('GAM7', GAM7)
          GAM7.graphic.GAM7_graphic()
          GAM7.graphic.remember_method(grap.GAM7_graphic)
          GAM7.table.new_tab(
              "GAM7",
              {
                  "GAM7": GAM7.graphic.excel.getGAM7()
              }
          )
          GAM7.remember_tabTable("GAM7", "GAM7", GAM7.graphic.excel.getGAM7())

          # FSUM7_GAM7 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(7).add_tab('FSUM7_GAM7', FSUM7_GAM7)
          # FSUM7_GAM7.graphic.FSUM7_GAM7_graphic()
          # FSUM7_GAM7.table.new_tab(
          #     "FSUM7_GAM7",
          #     {
          #         "FSUM7": FSUM7_GAM7.graphic.excel.getFSUM7(),
          #         "GAM7": FSUM7_GAM7.graphic.excel.getGAM7()
          #     }
          # )

          # FSUM7_BETA7 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(7).add_tab('FSUM7_BETA7', FSUM7_BETA7)
          # FSUM7_BETA7.graphic.FSUM6_BETA6_graphic()
          # FSUM7_BETA7.table.new_tab(
          #     "FSUM7_BETA7",
          #     {
          #         "FSUM7": FSUM7_BETA7.graphic.excel.getFSUM7(),
          #         "BETA7": FSUM7_BETA7.graphic.excel.getBETA7()
          #     }
          # )
        
        if (self.tabWidget.widget(0).target == "trajectories"):
          
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True
            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            yg_bearing = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg_bearing)
            yg_bearing.graphic.yg_bearing_graphic()
            yg_bearing.table.new_tab(
              "yg_bearing",
              {
                  "xg": yg_bearing.graphic.excel.xg(),
                  "yg": yg_bearing.graphic.excel.yg()
              }
            )

            yg_shaft = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg_shaft)
            yg_shaft.graphic.yg_shaft_graphic()
            yg_shaft.table.new_tab(
              "yg_shaft",
              {
                  "xq": yg_shaft.graphic.excel.xq(),
                  "yq": yg_shaft.graphic.excel.yq()
              }
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:

            self.AreTabsHere1 = True

            yg1_bearing = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg1_bearing)
            yg1_bearing.graphic.yg1_bearing_graphic()
            yg1_bearing.table.new_tab(
              "yg1_bearing",
              {
                  "xg1": yg1_bearing.graphic.excel.xg1(),
                  "yg1": yg1_bearing.graphic.excel.yg1()
              }
            )

            yg1_shaft = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg1_shaft)
            yg1_shaft.graphic.yg1_shaft_graphic()
            yg1_shaft.table.new_tab(
              "yg1_shaft",
              {
                  "xq1": yg1_shaft.graphic.excel.xq1(),
                  "yq1": yg1_shaft.graphic.excel.yq1()
              }
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:

            self.AreTabsHere2 = True

            yg2_bearing = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg2_bearing)
            yg2_bearing.graphic.yg2_bearing_graphic()
            yg2_bearing.table.new_tab(
              "yg2_bearing",
              {
                  "xg2": yg2_bearing.graphic.excel.xg2(),
                  "yg2": yg2_bearing.graphic.excel.yg2()
              }
            )

            yg2_shaft = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg2_shaft)
            yg2_shaft.graphic.yg2_shaft_graphic()
            yg2_shaft.table.new_tab(
              "yg2_shaft",
              {
                  "xq2": yg2_shaft.graphic.excel.xq2(),
                  "yq2": yg2_shaft.graphic.excel.yq2()
              }
            )
          
          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:

            self.AreTabsHere3 = True

            yg3_bearing = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg3_bearing)
            yg3_bearing.graphic.yg3_bearing_graphic()
            yg3_bearing.table.new_tab(
              "yg3_bearing",
              {
                  "xg3": yg3_bearing.graphic.excel.xg3(),
                  "yg3": yg3_bearing.graphic.excel.yg3()
              }
            )

            yg3_shaft = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg3_shaft)
            yg3_shaft.graphic.yg3_shaft_graphic()
            yg3_shaft.table.new_tab(
              "yg3_shaft",
              {
                  "xq3": yg3_shaft.graphic.excel.xq3(),
                  "yq3": yg3_shaft.graphic.excel.yq3()
              }
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:

            self.AreTabsHere4 = True

            yg4_bearing = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg4_bearing)
            yg4_bearing.graphic.yg4_bearing_graphic()
            yg4_bearing.table.new_tab(
              "yg4_bearing",
              {
                  "xg4": yg4_bearing.graphic.excel.xg4(),
                  "yg4": yg4_bearing.graphic.excel.yg4()
              }
            )

            yg4_shaft = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg4_shaft)
            yg4_shaft.graphic.yg4_shaft_graphic()
            yg4_shaft.table.new_tab(
              "yg4_shaft",
              {
                  "xq4": yg4_shaft.graphic.excel.xq4(),
                  "yq4": yg4_shaft.graphic.excel.yq4()
              }
            )
        # if (self.tabWidget.currentIndex() == 5):
        #   print(self.tabWidget.currentIndex())
        #   print(not self.AreTabsHere5)
        #   print(self.engine)
        #   print(self.tabWidget.widget(5).target)
        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "trajectories"):
          
          self.AreTabsHere5 = True

          yg5_bearing = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg5_bearing)
          yg5_bearing.graphic.yg5_bearing_graphic()
          yg5_bearing.table.new_tab(
            "yg5_bearing",
            {
                "xg5": yg5_bearing.graphic.excel.xg5(),
                "yg5": yg5_bearing.graphic.excel.yg5()
            }
          )

          yg5_shaft = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg5_shaft)
          yg5_shaft.graphic.yg5_shaft_graphic()
          yg5_shaft.table.new_tab(
            "yg5_shaft",
            {
                "xq5": yg5_shaft.graphic.excel.xq5(),
                "yq5": yg5_shaft.graphic.excel.yq5()
            }
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "trajectories"):
          
          self.AreTabsHere6 = True

          yg6_bearing = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg6_bearing)
          yg6_bearing.graphic.yg6_bearing_graphic()
          yg6_bearing.table.new_tab(
            "yg6_bearing",
            {
                "xg6": yg6_bearing.graphic.excel.xg6(),
                "yg6": yg6_bearing.graphic.excel.yg6()
            }
          )

          yg6_shaft = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg6_shaft)
          yg6_shaft.graphic.yg6_shaft_graphic()
          yg6_shaft.table.new_tab(
            "yg6_shaft",
            {
                "xq6": yg6_shaft.graphic.excel.xq6(),
                "yq6": yg6_shaft.graphic.excel.yq6()
            }
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "trajectories"):
          
          self.AreTabsHere7 = True

          yg7_bearing = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab("CENTER LOCUS (ORBIT) - Bearing angle", yg7_bearing)
          yg7_bearing.graphic.yg7_bearing_graphic()
          yg7_bearing.table.new_tab(
            "yg7_bearing",
            {
                "xg7": yg7_bearing.graphic.excel.xg7(),
                "yg7": yg7_bearing.graphic.excel.yg7()
            }
          )

          yg7_shaft = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab("CENTER LOCUS (ORBIT) - Shaft angle", yg7_shaft)
          yg7_shaft.graphic.yg7_shaft_graphic()
          yg7_shaft.table.new_tab(
            "yg7_shaft",
            {
                "xq7": yg7_shaft.graphic.excel.xq7(),
                "yq7": yg7_shaft.graphic.excel.yq7()
            }
          )

        if (self.tabWidget.widget(0).target == "The angle of the direction"):
            
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True
            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            ugm = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(0).add_tab("ugm", ugm)
            ugm.graphic.ugm_graphic()
            ugm.graphic.remember_method(grap.ugm_graphic)
            ugm.table.new_tab(
              "ugm",
              {
                  "ugm": ugm.graphic.excel.ugm(),
              }
            )
            ugm.remember_tabTable("ugm", "ugm", ugm.graphic.excel.ugm())

            ugw = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(0).add_tab("ugw", ugw)
            ugw.graphic.ugw_graphic()
            ugw.graphic.remember_method(grap.ugw_graphic)
            ugw.table.new_tab(
              "ugw",
              {
                  "ugw": ugw.graphic.excel.ugw(),
              }
            )
            ugw.remember_tabTable("ugw", "ugw", ugw.graphic.excel.ugw())

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:

            self.AreTabsHere1 = True

            ugm1 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(1).add_tab("ugm1", ugm1)
            ugm1.graphic.ugm1_graphic()
            ugm1.graphic.remember_method(grap.ugm1_graphic)
            ugm1.table.new_tab(
              "ugm1",
              {
                  "ugm1": ugm1.graphic.excel.ugm1(),
              }
            )
            ugm1.remember_tabTable("ugm1", "ugm1", ugm1.graphic.excel.ugm1())

            ugw1 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(1).add_tab("ugw1", ugw1)
            ugw1.graphic.ugw1_graphic()
            ugw1.graphic.remember_method(grap.ugw1_graphic)
            ugw1.table.new_tab(
              "ugw1",
              {
                  "ugw1": ugw1.graphic.excel.ugw1(),
              }
            )
            ugw1.remember_tabTable("ugw1", "ugw1", ugw1.graphic.excel.ugw1())

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:

            self.AreTabsHere2 = True

            ugm2 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(2).add_tab("ugm2", ugm2)
            ugm2.graphic.ugm2_graphic()
            ugm2.graphic.remember_method(grap.ugm2_graphic)
            ugm2.table.new_tab(
              "ugm2",
              {
                  "ugm2": ugm2.graphic.excel.ugm2(),
              }
            )
            ugm2.remember_tabTable("ugm2", "ugm2", ugm2.graphic.excel.ugm2())

            ugw2 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(2).add_tab("ugw2", ugw2)
            ugw2.graphic.ugw2_graphic()
            ugw2.graphic.remember_method(grap.ugw2_graphic)
            ugw2.table.new_tab(
              "ugw2",
              {
                  "ugw2": ugw2.graphic.excel.ugw2(),
              }
            )
            ugw2.remember_tabTable("ugw2", "ugw2", ugw2.graphic.excel.ugw2())
          
          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:

            self.AreTabsHere3 = True

            ugm3 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(3).add_tab("ugm3", ugm3)
            ugm3.graphic.ugm3_graphic()
            ugm3.graphic.remember_method(grap.ugm3_graphic)
            ugm3.table.new_tab(
              "ugm3",
              {
                  "ugm3": ugm3.graphic.excel.ugm3(),
              }
            )
            ugm3.remember_tabTable("ugm3", "ugm3", ugm3.graphic.excel.ugm3())

            ugw3 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(3).add_tab("ugw3", ugw3)
            ugw3.graphic.ugw3_graphic()
            ugw3.graphic.remember_method(grap.ugw3_graphic)
            ugw3.table.new_tab(
              "ugw3",
              {
                  "ugw3": ugw3.graphic.excel.ugw3(),
              }
            )
            ugw3.remember_tabTable("ugw3", "ugw3", ugw3.graphic.excel.ugw3())

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:

            self.AreTabsHere4 = True

            ugm4 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(4).add_tab("ugm4", ugm4)
            ugm4.graphic.ugm4_graphic()
            ugm4.graphic.remember_method(grap.ugm4_graphic)
            ugm4.table.new_tab(
              "ugm4",
              {
                  "ugm4": ugm4.graphic.excel.ugm4(),
              }
            )
            ugm4.remember_tabTable("ugm4", "ugm4", ugm4.graphic.excel.ugm4())

            ugw4 = MainWidget(self.path_to_res, 'cartesian')
            self.tabWidget.widget(4).add_tab("ugw4", ugw4)
            ugw4.graphic.ugw4_graphic()
            ugw4.graphic.remember_method(grap.ugw4_graphic)
            ugw4.table.new_tab(
              "ugw4",
              {
                  "ugw4": ugw4.graphic.excel.ugw4(),
              }
            )
            ugw4.remember_tabTable("ugw4", "ugw4", ugw4.graphic.excel.ugw4())

        # if (self.tabWidget.currentIndex() == 5):
        #   print(self.tabWidget.currentIndex())
        #   print(not self.AreTabsHere5)
        #   print(self.engine)
        #   print(self.tabWidget.widget(5).target)
        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "The angle of the direction"):
          
          self.AreTabsHere5 = True

          ugm5 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(5).add_tab("ugm5", ugm5)
          ugm5.graphic.ugm5_graphic()
          ugm5.graphic.remember_method(grap.ugm5_graphic)
          ugm5.table.new_tab(
            "ugm5",
            {
                "ugm5": ugm5.graphic.excel.ugm5(),
            }
          )
          ugm5.remember_tabTable("ugm5", "ugm5", ugm5.graphic.excel.ugm5())

          ugw5 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(5).add_tab("ugw5", ugw5)
          ugw5.graphic.ugw5_graphic()
          ugw5.graphic.remember_method(grap.ugw5_graphic)
          ugw5.table.new_tab(
            "ugw5",
            {
                "ugw5": ugw5.graphic.excel.ugw5(),
            }
          )
          ugw5.remember_tabTable("ugw5", "ugw5", ugw5.graphic.excel.ugw5())

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "The angle of the direction"):
          
          self.AreTabsHere6 = True

          ugm6 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(6).add_tab("ugm6", ugm6)
          ugm6.graphic.ugm6_graphic()
          ugm6.graphic.remember_method(grap.ugm6_graphic)
          ugm6.table.new_tab(
            "ugm6",
            {
                "ugm6": ugm6.graphic.excel.ugm6(),
            }
          )
          ugm6.remember_tabTable("ugm6", "ugm6", ugm6.graphic.excel.ugm6())

          ugw6 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(6).add_tab("ugw6", ugw6)
          ugw6.graphic.ugw6_graphic()
          ugw6.graphic.remember_method(grap.ugw6_graphic)
          ugw6.table.new_tab(
            "ugw6",
            {
                "ugw6": ugw6.graphic.excel.ugw6(),
            }
          )
          ugw6.remember_tabTable("ugw6", "ugw6", ugw6.graphic.excel.ugw6())

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "The angle of the direction"):
          
          self.AreTabsHere7 = True

          ugm7 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(7).add_tab("ugm7", ugm7)
          ugm7.graphic.ugm7_graphic()
          ugm7.graphic.remember_method(grap.ugm7_graphic)
          ugm7.table.new_tab(
            "ugm7",
            {
                "ugm7": ugm7.graphic.excel.ugm7(),
            }
          )
          ugm7.remember_tabTable("ugm7", "ugm7", ugm7.graphic.excel.ugm7())

          ugw7 = MainWidget(self.path_to_res, 'cartesian')
          self.tabWidget.widget(7).add_tab("ugw7", ugw7)
          ugw7.graphic.ugw7_graphic()
          ugw7.graphic.remember_method(grap.ugw7_graphic)
          ugw7.table.new_tab(
            "ugw7",
            {
                "ugw7": ugw7.graphic.excel.ugw7(),
            }
          )
          ugw7.remember_tabTable("ugw7", "ugw7", ugw7.graphic.excel.ugw7())

        if (self.tabWidget.widget(0).target == "hmin"):

          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True
            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            hmin = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(0).add_tab("Hmin  vs  CRANK ANGLE", hmin)
            hmin.graphic.hmin_graphic()
            hmin.graphic.remember_method(grap.hmin_graphic)
            hmin.table.new_tab(
              "hmin",
              {
                  "hmin": hmin.graphic.excel.hmin(),
              }
            )
            hmin.remember_tabTable("hmin", "hmin", hmin.graphic.excel.hmin())

            # hmin_GAM = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(0).add_tab("hmin_GAM", hmin_GAM)
            # hmin_GAM.graphic.hmin_GAM()
            # hmin_GAM.table.new_tab(
            #   "hmin_GAM",
            #   {
            #       "hmin": hmin_GAM.graphic.excel.hmin(),
            #       "GAM": hmin_GAM.graphic.excel.getGAM(),
            #   },
            # )

            # hmin_BETA = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(0).add_tab("hmin_BETA", hmin_BETA)
            # hmin_BETA.graphic.hmin_BETA()
            # hmin_BETA.table.new_tab(
            #   "hmin_BETA",
            #   {
            #       "hmin": hmin_BETA.graphic.excel.hmin(),
            #       "BETA": hmin_BETA.graphic.excel.getBETA(),
            #   },
            # )

            FFT_bearing = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("Распределение минимальных толщин относительно подшипника", FFT_bearing)
            FFT_bearing.graphic.FFT_bearing_graphic()
            FFT_bearing.table.new_tab(
                "FFT",
                {
                  "FFT": FFT_bearing.graphic.excel.FFT_bearing(),
                },
            )

            FFT_shaft = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("Распределение минимальных толщин относительно вала", FFT_shaft)
            FFT_shaft.graphic.FFT_shaft_graphic()
            FFT_shaft.table.new_tab(
                "FFT",
                {
                  "FFT": FFT_shaft.graphic.excel.FFT_shaft(),
                },
            )

            hmin_ugwt = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("Oil Film Thickness vs Shaft Angle", hmin_ugwt)
            hmin_ugwt.graphic.hmin_ugwt_cartesian_graphic()
            if self.data.current_mode == 2:
              hmin_ugwt.table.new_tab(
                  "hmin_ugwt",
                  {
                    "hmin": hmin_ugwt.graphic.excel.hmin(),
                    "ugwt": self.data.ugwt_mode1[1440:],
                  },
              )
            elif self.data.current_mode == 3:
              hmin_ugwt.table.new_tab(
                  "hmin_ugwt",
                  {
                    "hmin": hmin_ugwt.graphic.excel.hmin(),
                    "ugwt": self.data.ugwt_mode2[1440:],
                  },
              )
            elif self.data.current_mode == 4:
              hmin_ugwt.table.new_tab(
                  "hmin_ugwt",
                  {
                    "hmin": hmin_ugwt.graphic.excel.hmin(),
                    "ugwt": self.data.ugwt_mode3[1440:],
                  },
              )

            hmin_FHMIN = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab("MOFT (mm)", hmin_FHMIN)
            hmin_FHMIN.graphic.hmin_FHMIN()
            hmin_FHMIN.table.new_tab(
                "hmin_FHMIN",
                {
                  "hmin": hmin_FHMIN.graphic.excel.hmin(),
                  "FHMIN": hmin_FHMIN.graphic.excel.FHMIN(),
                },
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:

            self.AreTabsHere1 = True

            hmin1 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(1).add_tab("Hmin  vs  CRANK ANGLE", hmin1)
            hmin1.graphic.hmin1_graphic()
            hmin1.graphic.remember_method(grap.hmin1_graphic)
            hmin1.table.new_tab(
              "hmin1",
              {
                  "hmin1": hmin1.graphic.excel.hmin1(),
              }
            )
            hmin1.remember_tabTable("hmin1", "hmin1", hmin1.graphic.excel.hmin1())

            # hmin1_GAM1 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(1).add_tab("hmin1_GAM1", hmin1_GAM1)
            # hmin1_GAM1.graphic.hmin1_GAM1()
            # hmin1_GAM1.table.new_tab(
            #   "hmin1_GAM1",
            #   {
            #       "hmin1": hmin1_GAM1.graphic.excel.hmin1(),
            #       "GAM1": hmin1_GAM1.graphic.excel.getGAM1(),
            #   },
            # )

            # hmin1_BETA1 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(1).add_tab("hmin1_BETA1", hmin1_BETA1)
            # hmin1_BETA1.graphic.hmin1_BETA1()
            # hmin1_BETA1.table.new_tab(
            #   "hmin1_BETA1",
            #   {
            #       "hmin1": hmin1_BETA1.graphic.excel.hmin1(),
            #       "BETA1": hmin1_BETA1.graphic.excel.getBETA1(),
            #   },
            # )

            FFT1_bearing = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("Распределение минимальных толщин относительно подшипника", FFT1_bearing)
            FFT1_bearing.graphic.FFT1_bearing_graphic()
            FFT1_bearing.table.new_tab(
                "FFT1",
                {
                  "FFT1": FFT1_bearing.graphic.excel.FFT1_bearing(),
                },
            )

            FFT1_shaft = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("Распределение минимальных толщин относительно вала", FFT1_shaft)
            FFT1_shaft.graphic.FFT1_shaft_graphic()
            FFT1_shaft.table.new_tab(
                "FFT1",
                {
                  "FFT1": FFT1_shaft.graphic.excel.FFT1_shaft(),
                },
            )

            hmin1_ugwt1 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("Oil Film Thickness vs Shaft Angle", hmin1_ugwt1)
            hmin1_ugwt1.graphic.hmin1_ugwt1_cartesian_graphic()
            if self.data.current_mode == 2:
              hmin1_ugwt1.table.new_tab(
                  "hmin1_ugwt1",
                  {
                    "hmin1": hmin1_ugwt1.graphic.excel.hmin1(),
                    "ugwt1": self.data.ugwt1_mode1[1440:],
                  },
              )
            elif self.data.current_mode == 3:
              hmin1_ugwt1.table.new_tab(
                  "hmin1_ugwt1",
                  {
                    "hmin1": hmin1_ugwt1.graphic.excel.hmin1(),
                    "ugwt1": self.data.ugwt1_mode2[1440:],
                  },
              )
            elif self.data.current_mode == 4:
              hmin1_ugwt1.table.new_tab(
                  "hmin1_ugwt1",
                  {
                    "hmin1": hmin1_ugwt1.graphic.excel.hmin1(),
                    "ugwt1": self.data.ugwt1_mode3[1440:],
                  },
              )

            hmin1_FHMIN1 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab("MOFT (mm)", hmin1_FHMIN1)
            hmin1_FHMIN1.graphic.hmin1_FHMIN1()
            hmin1_FHMIN1.table.new_tab(
                "hmin1_FHMIN1",
                {
                  "hmin1": hmin1_FHMIN1.graphic.excel.hmin1(),
                  "FHMIN1": hmin1_FHMIN1.graphic.excel.FHMIN1(),
                },
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:

            self.AreTabsHere2 = True

            hmin2 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(2).add_tab("Hmin  vs  CRANK ANGLE", hmin2)
            hmin2.graphic.hmin2_graphic()
            hmin2.graphic.remember_method(grap.hmin2_graphic)
            hmin2.table.new_tab(
              "hmin2",
              {
                  "hmin2": hmin2.graphic.excel.hmin2(),
              }
            )
            hmin2.remember_tabTable ("hmin2", "hmin2", hmin2.graphic.excel.hmin2())

            # hmin2_GAM2 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(2).add_tab("hmin2_GAM2", hmin2_GAM2)
            # hmin2_GAM2.graphic.hmin2_GAM2()
            # hmin2_GAM2.table.new_tab(
            #   "hmin2_GAM2",
            #   {
            #       "hmin2": hmin2_GAM2.graphic.excel.hmin2(),
            #       "GAM2": hmin2_GAM2.graphic.excel.getGAM2(),
            #   },
            # )

            # hmin2_BETA2 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(2).add_tab("hmin2_BETA2", hmin2_BETA2)
            # hmin2_BETA2.graphic.hmin2_BETA2()
            # hmin2_BETA2.table.new_tab(
            #   "hmin2_BETA2",
            #   {
            #       "hmin2": hmin2_BETA2.graphic.excel.hmin2(),
            #       "BETA2": hmin2_BETA2.graphic.excel.getBETA2(),
            #   },
            # )

            FFT2_bearing = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("Распределение минимальных толщин относительно подшипника", FFT2_bearing)
            FFT2_bearing.graphic.FFT2_bearing_graphic()
            FFT2_bearing.table.new_tab(
                "FFT2",
                {
                  "FFT2": FFT2_bearing.graphic.excel.FFT2_bearing(),
                },
            )

            FFT2_shaft = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("Распределение минимальных толщин относительно вала", FFT2_shaft)
            FFT2_shaft.graphic.FFT2_shaft_graphic()
            FFT2_shaft.table.new_tab(
                "FFT2",
                {
                  "FFT2": FFT2_shaft.graphic.excel.FFT2_shaft(),
                },
            )

            hmin2_ugwt2 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("Oil Film Thickness vs Shaft Angle", hmin2_ugwt2)
            hmin2_ugwt2.graphic.hmin2_ugwt2_cartesian_graphic()
            if self.data.current_mode == 2:
              hmin2_ugwt2.table.new_tab(
                  "hmin2_ugwt2",
                  {
                    "hmin2": hmin2_ugwt2.graphic.excel.hmin2(),
                    "ugwt2": self.data.ugwt2_mode1[1440:],
                  },
              )
            elif self.data.current_mode == 3:
              hmin2_ugwt2.table.new_tab(
                  "hmin2_ugwt2",
                  {
                    "hmin2": hmin2_ugwt2.graphic.excel.hmin2(),
                    "ugwt2": self.data.ugwt2_mode2[1440:],
                  },
              )
            elif self.data.current_mode == 4:
              hmin2_ugwt2.table.new_tab(
                  "hmin2_ugwt2",
                  {
                    "hmin2": hmin2_ugwt2.graphic.excel.hmin2(),
                    "ugwt2": self.data.ugwt2_mode3[1440:],
                  },
              )

            hmin2_FHMIN2 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab("MOFT (mm)", hmin2_FHMIN2)
            hmin2_FHMIN2.graphic.hmin2_FHMIN2()
            hmin2_FHMIN2.table.new_tab(
                "hmin2_FHMIN2",
                {
                  "hmin2": hmin2_FHMIN2.graphic.excel.hmin2(),
                  "FHMIN2": hmin2_FHMIN2.graphic.excel.FHMIN2(),
                },
            )

          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:

            self.AreTabsHere3 = True

            hmin3 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(3).add_tab("Hmin  vs  CRANK ANGLE", hmin3)
            hmin3.graphic.hmin3_graphic()
            hmin3.graphic.remember_method(grap.hmin3_graphic)
            hmin3.table.new_tab(
              "hmin3",
              {
                  "hmin3": hmin3.graphic.excel.hmin3(),
              }
            )
            hmin3.remember_tabTable("hmin3", "hmin3", hmin3.graphic.excel.hmin3())

            # hmin3_GAM3 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(3).add_tab("hmin3_GAM3", hmin3_GAM3)
            # hmin3_GAM3.graphic.hmin3_GAM3()
            # hmin3_GAM3.table.new_tab(
            #   "hmin3_GAM3",
            #   {
            #       "hmin3": hmin3_GAM3.graphic.excel.hmin3(),
            #       "GAM3": hmin3_GAM3.graphic.excel.getGAM3(),
            #   },
            # )

            # hmin3_BETA3 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(3).add_tab("hmin3_BETA3", hmin3_BETA3)
            # hmin3_BETA3.graphic.hmin3_BETA3()
            # hmin3_BETA3.table.new_tab(
            #   "hmin3_BETA3",
            #   {
            #       "hmin3": hmin3_BETA3.graphic.excel.hmin3(),
            #       "BETA3": hmin3_BETA3.graphic.excel.getBETA3(),
            #   },
            # )

            FFT3_bearing = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("Распределение минимальных толщин относительно подшипника", FFT3_bearing)
            FFT3_bearing.graphic.FFT3_bearing_graphic()
            FFT3_bearing.table.new_tab(
                "FFT3",
                {
                  "FFT3": FFT3_bearing.graphic.excel.FFT3_bearing(),
                },
            )

            FFT3_shaft = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("Распределение минимальных толщин относительно вала", FFT3_shaft)
            FFT3_shaft.graphic.FFT3_shaft_graphic()
            FFT3_shaft.table.new_tab(
                "FFT3",
                {
                  "FFT3": FFT3_shaft.graphic.excel.FFT3_shaft(),
                },
            )

            hmin3_ugwt3 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("Oil Film Thickness vs Shaft Angle", hmin3_ugwt3)
            hmin3_ugwt3.graphic.hmin3_ugwt3_cartesian_graphic()
            if self.data.current_mode == 2:
              hmin3_ugwt3.table.new_tab(
                  "hmin3_ugwt3",
                  {
                    "hmin3": hmin3_ugwt3.graphic.excel.hmin3(),
                    "ugwt3": self.data.ugwt3_mode1[1440:],
                  },
              )
            elif self.data.current_mode == 3:
              hmin3_ugwt3.table.new_tab(
                  "hmin3_ugwt3",
                  {
                    "hmin3": hmin3_ugwt3.graphic.excel.hmin3(),
                    "ugwt3": self.data.ugwt3_mode2[1440:],
                  },
              )
            elif self.data.current_mode == 4:
              hmin3_ugwt3.table.new_tab(
                  "hmin3_ugwt3",
                  {
                    "hmin3": hmin3_ugwt3.graphic.excel.hmin3(),
                    "ugwt3": self.data.ugwt3_mode3[1440:],
                  },
              )

            hmin3_FHMIN3 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab("MOFT (mm)", hmin3_FHMIN3)
            hmin3_FHMIN3.graphic.hmin3_FHMIN3()
            hmin3_FHMIN3.table.new_tab(
                "hmin3_FHMIN3",
                {
                  "hmin3": hmin3_FHMIN3.graphic.excel.hmin3(),
                  "FHMIN3": hmin3_FHMIN3.graphic.excel.FHMIN3(),
                },
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:

            self.AreTabsHere4 = True

            hmin4 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(4).add_tab("Hmin  vs  CRANK ANGLE", hmin4)
            hmin4.graphic.hmin4_graphic()
            hmin4.graphic.remember_method(grap.hmin4_graphic)
            hmin4.table.new_tab(
              "hmin4",
              {
                  "hmin4": hmin4.graphic.excel.hmin4(),
              }
            )
            hmin4.remember_tabTable("hmin4", "hmin4", hmin4.graphic.excel.hmin4())

            # hmin4_GAM4 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(4).add_tab("hmin4_GAM4", hmin4_GAM4)
            # hmin4_GAM4.graphic.hmin4_GAM4()
            # hmin4_GAM4.table.new_tab(
            #   "hmin4_GAM4",
            #   {
            #       "hmin4": hmin4_GAM4.graphic.excel.hmin4(),
            #       "GAM4": hmin4_GAM4.graphic.excel.getGAM4(),
            #   },
            # )

            # hmin4_BETA4 = MainWidget(self.path_to_res, 'polar')
            # self.tabWidget.widget(4).add_tab("hmin4_BETA4", hmin4_BETA4)
            # hmin4_BETA4.graphic.hmin4_BETA4()
            # hmin4_BETA4.table.new_tab(
            #   "hmin4_BETA4",
            #   {
            #       "hmin4": hmin4_BETA4.graphic.excel.hmin4(),
            #       "BETA4": hmin4_BETA4.graphic.excel.getBETA4(),
            #   },
            # )

            FFT4_bearing = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("Распределение минимальных толщин относительно подшипника", FFT4_bearing)
            FFT4_bearing.graphic.FFT4_bearing_graphic()
            FFT4_bearing.table.new_tab(
                "FFT4",
                {
                  "FFT4": FFT4_bearing.graphic.excel.FFT4_bearing(),
                },
            )

            FFT4_shaft = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("Распределение минимальных толщин относительно вала", FFT4_shaft)
            FFT4_shaft.graphic.FFT4_shaft_graphic()
            FFT4_shaft.table.new_tab(
                "FFT4",
                {
                  "FFT4": FFT4_shaft.graphic.excel.FFT4_shaft(),
                },
            )

            hmin4_ugwt4 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("Oil Film Thickness vs Shaft Angle", hmin4_ugwt4)
            hmin4_ugwt4.graphic.hmin4_ugwt4_cartesian_graphic()
            if self.data.current_mode == 2:
              hmin4_ugwt4.table.new_tab(
                  "hmin4_ugwt4",
                  {
                    "hmin4": hmin4_ugwt4.graphic.excel.hmin4(),
                    "ugwt4": self.data.ugwt4_mode1[1440:],
                  },
              )
            if self.data.current_mode == 3:
              hmin4_ugwt4.table.new_tab(
                  "hmin4_ugwt4",
                  {
                    "hmin4": hmin4_ugwt4.graphic.excel.hmin4(),
                    "ugwt4": self.data.ugwt4_mode2[1440:],
                  },
              )
            if self.data.current_mode == 4:
              hmin4_ugwt4.table.new_tab(
                  "hmin4_ugwt4",
                  {
                    "hmin4": hmin4_ugwt4.graphic.excel.hmin4(),
                    "ugwt4": self.data.ugwt4_mode3[1440:],
                  },
              )

            hmin4_FHMIN4 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab("MOFT (mm)", hmin4_FHMIN4)
            hmin4_FHMIN4.graphic.hmin4_FHMIN4()
            hmin4_FHMIN4.table.new_tab(
                "hmin4_FHMIN4",
                {
                  "hmin4": hmin4_FHMIN4.graphic.excel.hmin4(),
                  "FHMIN4": hmin4_FHMIN4.graphic.excel.FHMIN4(),
                },
            )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "hmin"):
          
          self.AreTabsHere5 = True

          hmin5 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(5).add_tab("Hmin  vs  CRANK ANGLE", hmin5)
          hmin5.graphic.hmin5_graphic()
          hmin5.graphic.remember_method(grap.hmin5_graphic)
          hmin5.table.new_tab(
            "hmin5",
            {
                "hmin5": hmin5.graphic.excel.hmin5(),
            }
          )
          hmin5.remember_tabTable("hmin5", "hmin5", hmin5.graphic.excel.hmin5())

          # hmin5_GAM5 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(5).add_tab("hmin5_GAM5", hmin5_GAM5)
          # hmin5_GAM5.graphic.hmin5_GAM5()
          # hmin5_GAM5.table.new_tab(
          #     "hmin5_GAM5",
          #     {
          #       "hmin5": hmin5_GAM5.graphic.excel.hmin5(),
          #       "GAM5": hmin5_GAM5.graphic.excel.getGAM5(),
          #     },
          # )

          # hmin5_BETA5 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(5).add_tab("hmin5_BETA5", hmin5_BETA5)
          # hmin5_BETA5.graphic.hmin5_BETA5()
          # hmin5_BETA5.table.new_tab(
          #     "hmin5_BETA5",
          #     {
          #       "hmin5": hmin5_BETA5.graphic.excel.hmin5(),
          #       "BETA5": hmin5_BETA5.graphic.excel.getBETA5(),
          #     },
          # )

          FFT5_bearing = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Распределение минимальных толщин относительно подшипника", FFT5_bearing)
          FFT5_bearing.graphic.FFT5_bearing_graphic()
          FFT5_bearing.table.new_tab(
              "FFT5",
              {
                "FFT5": FFT5_bearing.graphic.excel.FFT5_bearing(),
              },
          )

          FFT5_shaft = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Распределение минимальных толщин относительно вала", FFT5_shaft)
          FFT5_shaft.graphic.FFT5_shaft_graphic()
          FFT5_shaft.table.new_tab(
              "FFT5",
              {
                "FFT5": FFT5_shaft.graphic.excel.FFT5_shaft(),
              },
          )

          hmin5_ugwt5 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Oil Film Thickness vs Shaft Angle", hmin5_ugwt5)
          hmin5_ugwt5.graphic.hmin5_ugwt5_cartesian_graphic()
          if self.data.current_mode == 2:
            hmin5_ugwt5.table.new_tab(
                "hmin5_ugwt5",
                {
                  "hmin5": hmin5_ugwt5.graphic.excel.hmin5(),
                  "ugwt5": self.data.ugwt5_mode1[1440:],
                },
            )
          elif self.data.current_mode == 3:
            hmin5_ugwt5.table.new_tab(
                "hmin5_ugwt5",
                {
                  "hmin5": hmin5_ugwt5.graphic.excel.hmin5(),
                  "ugwt5": self.data.ugwt5_mode2[1440:],
                },
            )
          elif self.data.current_mode == 4:
            hmin5_ugwt5.table.new_tab(
                "hmin5_ugwt5",
                {
                  "hmin5": hmin5_ugwt5.graphic.excel.hmin5(),
                  "ugwt5": self.data.ugwt5_mode3[1440:],
                },
            )

          hmin5_FHMIN5 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab("MOFT (mm)", hmin5_FHMIN5)
          hmin5_FHMIN5.graphic.hmin5_FHMIN5()
          hmin5_FHMIN5.table.new_tab(
              "hmin5_FHMIN5",
              {
                "hmin5": hmin5_FHMIN5.graphic.excel.hmin5(),
                "FHMIN5": hmin5_FHMIN5.graphic.excel.FHMIN5(),
              },
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "hmin"):
          
          self.AreTabsHere6 = True

          hmin6 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(6).add_tab("Hmin  vs  CRANK ANGLE ", hmin6)
          hmin6.graphic.hmin6_graphic()
          hmin6.graphic.remember_method(grap.hmin6_graphic)
          hmin6.table.new_tab(
            "hmin6",
            {
                "hmin6": hmin6.graphic.excel.hmin6(),
            }
          )
          hmin6.remember_tabTable("hmin6", "hmin6", hmin6.graphic.excel.hmin6())


          # hmin6_GAM6 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(6).add_tab("hmin6_GAM6", hmin6_GAM6)
          # hmin6_GAM6.graphic.hmin6_GAM6()
          # hmin6_GAM6.table.new_tab(
          #     "hmin6_GAM6",
          #     {
          #       "hmin6": hmin6_GAM6.graphic.excel.hmin6(),
          #       "GAM6": hmin6_GAM6.graphic.excel.getGAM6(),
          #     },
          # )

          # hmin6_BETA6 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(6).add_tab("hmin6_BETA6", hmin6_BETA6)
          # hmin6_BETA6.graphic.hmin6_BETA6()
          # hmin6_BETA6.table.new_tab(
          #     "hmin6_BETA6",
          #     {
          #       "hmin6": hmin6_BETA6.graphic.excel.hmin6(),
          #       "BETA6": hmin6_BETA6.graphic.excel.getBETA6(),
          #     },
          # )

          FFT6_bearing = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("Распределение минимальных толщин относительно подшипника", FFT6_bearing)
          FFT6_bearing.graphic.FFT6_bearing_graphic()
          FFT6_bearing.table.new_tab(
              "FFT6",
              {
                "FFT6": FFT6_bearing.graphic.excel.FFT6_bearing(),
              },
          )

          FFT6_shaft = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("Распределение минимальных толщин относительно вала", FFT6_shaft)
          FFT6_shaft.graphic.FFT6_shaft_graphic()
          FFT6_shaft.table.new_tab(
              "FFT6",
              {
                "FFT6": FFT6_shaft.graphic.excel.FFT6_shaft(),
              },
          )

          hmin6_ugwt6 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("Oil Film Thickness vs Shaft Angle", hmin6_ugwt6)
          hmin6_ugwt6.graphic.hmin6_ugwt6_cartesian_graphic()
          if self.data.current_mode == 2:
            hmin6_ugwt6.table.new_tab(
                "hmin6_ugwt6",
                {
                  "hmin6": hmin6_ugwt6.graphic.excel.hmin6(),
                  "ugwt6": self.data.ugwt6_mode1[1440:],
                },
            )
          elif self.data.current_mode == 3:
            hmin6_ugwt6.table.new_tab(
                "hmin6_ugwt6",
                {
                  "hmin6": hmin6_ugwt6.graphic.excel.hmin6(),
                  "ugwt6": self.data.ugwt6_mode2[1440:],
                },
            )
          elif self.data.current_mode == 4:
            hmin6_ugwt6.table.new_tab(
                "hmin6_ugwt6",
                {
                  "hmin6": hmin6_ugwt6.graphic.excel.hmin6(),
                  "ugwt6": self.data.ugwt6_mode3[1440:],
                },
            )

          hmin6_FHMIN6 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab("MOFT (mm)", hmin6_FHMIN6)
          hmin6_FHMIN6.graphic.hmin6_FHMIN6()
          hmin6_FHMIN6.table.new_tab(
              "hmin6_FHMIN6",
              {
                "hmin6": hmin6_FHMIN6.graphic.excel.hmin6(),
                "FHMIN6": hmin6_FHMIN6.graphic.excel.FHMIN(),
              },
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "hmin"):
          
          self.AreTabsHere7 = True
          hmin7 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(7).add_tab("Hmin  vs  CRANK ANGLE", hmin7)
          hmin7.graphic.hmin7_graphic()
          hmin7.graphic.remember_method(grap.hmin7_graphic)
          hmin7.table.new_tab(
            "hmin7",
            {
                "hmin7": hmin7.graphic.excel.hmin7(),
            }
          )
          hmin7.remember_tabTable("hmin7", "hmin7", hmin7.graphic.excel.hmin7())

          # hmin7_GAM7 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(7).add_tab("hmin7_GAM7", hmin7_GAM7)
          # hmin7_GAM7.graphic.hmin7_GAM7()
          # hmin7_GAM7.table.new_tab(
          #     "hmin7_GAM7",
          #     {
          #       "hmin7": hmin7_GAM7.graphic.excel.hmin7(),
          #       "GAM7": hmin7_GAM7.graphic.excel.getGAM7(),
          #     },
          # )

          # hmin7_BETA7 = MainWidget(self.path_to_res, 'polar')
          # self.tabWidget.widget(7).add_tab("hmin7_BETA7", hmin7_BETA7)
          # hmin7_BETA7.graphic.hmin7_BETA7()
          # hmin7_BETA7.table.new_tab(
          #     "hmin7_BETA7",
          #     {
          #       "hmin7": hmin7_BETA7.graphic.excel.hmin(),
          #       "BETA7": hmin7_BETA7.graphic.excel.getBETA7(),
          #     },
          # )

          FFT7_bearing = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("Распределение минимальных толщин относительно подшипника", FFT7_bearing)
          FFT7_bearing.graphic.FFT7_bearing_graphic()
          FFT7_bearing.table.new_tab(
              "FFT7",
              {
                "FFT7": FFT7_bearing.graphic.excel.FFT7_bearing(),
              },
          )

          FFT7_shaft = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("Распределение минимальных толщин относительно вала", FFT7_shaft)
          FFT7_shaft.graphic.FFT7_shaft_graphic()
          FFT7_shaft.table.new_tab(
              "FFT7",
              {
                "FFT7": FFT7_shaft.graphic.excel.FFT7_shaft(),
              },
          )

          hmin7_ugwt7 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("Oil Film Thickness vs Shaft Angle", hmin7_ugwt7)
          hmin7_ugwt7.graphic.hmin7_ugwt7_cartesian_graphic()
          if self.data.current_mode == 2:
            hmin7_ugwt7.table.new_tab(
                "hmin7_ugwt7",
                {
                  "hmin7": hmin7_ugwt7.graphic.excel.hmin7(),
                  "ugwt7": self.data.ugwt7_mode1[1440:],
                },
            )
          elif self.data.current_mode == 3:
            hmin7_ugwt7.table.new_tab(
                "hmin7_ugwt7",
                {
                  "hmin7": hmin7_ugwt7.graphic.excel.hmin7(),
                  "ugwt7": self.data.ugwt7_mode2[1440:],
                },
            )
          elif self.data.current_mode == 4:
            hmin7_ugwt7.table.new_tab(
                "hmin7_ugwt7",
                {
                  "hmin7": hmin7_ugwt7.graphic.excel.hmin7(),
                  "ugwt7": self.data.ugwt7_mode3[1440:],
                },
            )

          hmin7_FHMIN7 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab("MOFT (mm)", hmin7_FHMIN7)
          hmin7_FHMIN7.graphic.hmin7_FHMIN7()
          hmin7_FHMIN7.table.new_tab(
              "hmin7_FHMIN7",
              {
                "hmin7": hmin7_FHMIN7.graphic.excel.hmin7(),
                "FHMIN7": hmin7_FHMIN7.graphic.excel.FHMIN7(),
              },
          )
          
        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere8
            and (self.engine == 'L3' or self.engine == 'V6')
            and self.tabWidget.widget(5).target == "hmin"):
          print('HERE')
          self.AreTabsHere8 = True

          hmin_base = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Минимальные толщины масляных пленок для всех подшипников", hmin_base)
          hmin_base.graphic.hmin_base()
          hmin = list()
          hmin1 = list()
          hmin2 = list()
          hmin3 = list()
          hmin4 = list()
          hmin = [min(hmin_base.graphic.excel.hmin())]
          hmin1 = [min(hmin_base.graphic.excel.hmin1())]
          hmin2 = [min(hmin_base.graphic.excel.hmin2())]
          hmin3 = [min(hmin_base.graphic.excel.hmin3())]
          hmin4 = [min(hmin_base.graphic.excel.hmin4())]
          hmin_base.table.new_tab(
            "Минимальные толщины масляных пленок для всех подшипников",
            {
                "hmin": hmin,
                "hmin1": hmin1,
                "hmin2": hmin2,
                "hmin3": hmin3,
                "hmin4": hmin4,
            }
          )

          # hmin_base = MainWidget(self.path_to_res, 'cartesian1')
          # self.tabWidget.widget(5).add_tab("Минимальные толщины мин. масляных пленок для всех подшипников", hmin_base)
          # hmin_base.graphic.hmin_base()
          # hmin = list()
          # hmin1 = list()
          # hmin2 = list()
          # hmin3 = list()
          # hmin4 = list()
          # hmin = [min(hmin_base.graphic.excel.hmin())]
          # hmin1 = [min(hmin_base.graphic.excel.hmin1())]
          # hmin2 = [min(hmin_base.graphic.excel.hmin2())]
          # hmin3 = [min(hmin_base.graphic.excel.hmin3())]
          # hmin4 = [min(hmin_base.graphic.excel.hmin4())]
          # hmin_base.table.new_tab(
          #   "Минимальные толщины мин. масляных пленок для всех подшипников",
          #   {
          #       "hmin": hmin,
          #       "hmin1": hmin1,
          #       "hmin2": hmin2,
          #       "hmin3": hmin3,
          #       "hmin4": hmin4,
          #   }
          # )
        
        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere9
            and (self.engine == 'L4' or self.engine == 'V8')
            and self.tabWidget.widget(6).target == "hmin"):
            # print('HERE')
            self.AreTabsHere9 = True
            hmin_l4_v8 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(6).add_tab("Минимальные толщины мин. масляных пленок для всех подшипников", hmin_l4_v8)
            hmin_l4_v8.graphic.hmin_l4_v8()
            hmin = list()
            hmin1 = list()
            hmin2 = list()
            hmin3 = list()
            hmin4 = list()
            hmin5 = list()
            hmin = [min(hmin_l4_v8.graphic.excel.hmin())]
            hmin1 = [min(hmin_l4_v8.graphic.excel.hmin1())]
            hmin2 = [min(hmin_l4_v8.graphic.excel.hmin2())]
            hmin3 = [min(hmin_l4_v8.graphic.excel.hmin3())]
            hmin4 = [min(hmin_l4_v8.graphic.excel.hmin4())]
            hmin5 = [min(hmin_l4_v8.graphic.excel.hmin5())]
            hmin_l4_v8.table.new_tab(
              "Минимальные толщины мин. масляных пленок для всех подшипников",
              {
                  "hmin": hmin,
                  "hmin1": hmin1,
                  "hmin2": hmin2,
                  "hmin3": hmin3,
                  "hmin4": hmin4,
                  "hmin5": hmin5,
              }
            )
        if (self.tabWidget.currentIndex() == 8
            and not self.AreTabsHere10
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(8).target == "hmin"):
            
            self.AreTabsHere10 = True

            hmin_l6_v12 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(8).add_tab("Минимальные толщины мин. масляных пленок для всех подшипников", hmin_l6_v12)
            hmin_l6_v12.graphic.hmin_l6_v12()
            hmin = list()
            hmin1 = list()
            hmin2 = list()
            hmin3 = list()
            hmin4 = list()
            hmin5 = list()
            hmin6 = list()
            hmin7 = list()
            hmin = [min(hmin_l6_v12.graphic.excel.hmin())]
            hmin1 = [min(hmin_l6_v12.graphic.excel.hmin1())]
            hmin2 = [min(hmin_l6_v12.graphic.excel.hmin2())]
            hmin3 = [min(hmin_l6_v12.graphic.excel.hmin3())]
            hmin4 = [min(hmin_l6_v12.graphic.excel.hmin4())]
            hmin5 = [min(hmin_l6_v12.graphic.excel.hmin5())]
            hmin6 = [min(hmin_l6_v12.graphic.excel.hmin6())]
            hmin7 = [min(hmin_l6_v12.graphic.excel.hmin7())]
            hmin_l6_v12.table.new_tab(
              "Минимальные толщины мин. масляных пленок для всех подшипников",
              {
                  "hmin": hmin,
                  "hmin1": hmin1,
                  "hmin2": hmin2,
                  "hmin3": hmin3,
                  "hmin4": hmin4,
                  "hmin5": hmin5,
                  "hmin6": hmin6,
                  "hmin7": hmin7,
              }
            )

        # if (self.tabWidget.currentIndex() == 6
        #   and not self.AreTabsHere11
        #   and (self.engine == 'L3' or self.engine == 'V6')
        #   and self.tabWidget.widget(6).target == "hmin"):
          
        #   self.AreTabsHere11 = True

        #   FFT_bearing = MainWidget(self.path_to_res, 'cartesian')
        #   self.tabWidget.widget(6).add_tab("FFT_bearing", FFT_bearing)
        #   FFT_bearing.graphic.FFT_bearing_graphic()
        #   FFT_bearing.table.new_tab(
        #       "FFT",
        #       {
        #         "FFT": FFT_bearing.graphic.excel.FFT_bearing(),
        #       },
        #   )

        if (self.tabWidget.widget(0).target == "specific loads"):
            
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True
            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            PSUM = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(0).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM)
            PSUM.graphic.PSUM_graphic()
            PSUM.graphic.remember_method(grap.PSUM_graphic)
            PSUM.table.new_tab(
              "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
              {
                  "PSUM": PSUM.graphic.excel.PSUM(),
              }
            )
            PSUM.remember_tabTable("PSUM", "PSUM", PSUM.graphic.excel.PSUM())

            PSUM_GAM = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab('PSUM_GAM', PSUM_GAM)
            PSUM_GAM.graphic.PSUM_GAM_graphic()
            PSUM_GAM.table.new_tab(
                "PSUM_GAM",
                {
                    "PSUM": PSUM_GAM.graphic.excel.PSUM(),
                    "GAM": PSUM_GAM.graphic.excel.getGAM()
                }
            )

            PSUM_BETA = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab('PSUM_BETA', PSUM_BETA)
            PSUM_BETA.graphic.PSUM_BETA_graphic()
            PSUM_BETA.table.new_tab(
                "PSUM_BETA",
                {
                    "PSUM": PSUM_BETA.graphic.excel.PSUM(),
                    "BETA": PSUM_BETA.graphic.excel.getBETA()
                }
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:

            self.AreTabsHere1 = True

            PSUM1 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(1).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM1)
            PSUM1.graphic.PSUM1_graphic()
            PSUM1.graphic.remember_method(grap.PSUM1_graphic)
            PSUM1.table.new_tab(
              "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
              {
                  "PSUM1": PSUM1.graphic.excel.PSUM1(),
              }
            )
            PSUM1.remember_tabTable("PSUM1", "PSUM1", PSUM1.graphic.excel.PSUM1())

            PSUM1_GAM1 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab('PSUM1_GAM1', PSUM1_GAM1)
            PSUM1_GAM1.graphic.PSUM1_GAM1_graphic()
            PSUM1_GAM1.table.new_tab(
                "PSUM1_GAM1",
                {
                    "PSUM1": PSUM1_GAM1.graphic.excel.PSUM1(),
                    "GAM1": PSUM1_GAM1.graphic.excel.getGAM1()
                }
            )

            PSUM1_BETA1 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab('PSUM1_BETA1', PSUM1_BETA1)
            PSUM1_BETA1.graphic.PSUM1_BETA1_graphic()
            PSUM1_BETA1.table.new_tab(
                "PSUM1_BETA1",
                {
                    "PSUM1": PSUM1_BETA1.graphic.excel.PSUM1(),
                    "BETA1": PSUM1_BETA1.graphic.excel.getBETA1()
                }
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:

            self.AreTabsHere2 = True

            PSUM2 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(2).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM2)
            PSUM2.graphic.PSUM2_graphic()
            PSUM2.graphic.remember_method(grap.PSUM2_graphic)
            PSUM2.table.new_tab(
              "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
              {
                  "PSUM2": PSUM2.graphic.excel.PSUM2(),
              }
            )
            PSUM2.remember_tabTable("PSUM2", "PSUM2", PSUM2.graphic.excel.PSUM2())

            PSUM2_GAM2 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab('PSUM2_GAM2', PSUM2_GAM2)
            PSUM2_GAM2.graphic.PSUM2_GAM2_graphic()
            PSUM2_GAM2.table.new_tab(
                "PSUM2_GAM2",
                {
                    "PSUM2": PSUM2_GAM2.graphic.excel.PSUM2(),
                    "GAM2": PSUM2_GAM2.graphic.excel.getGAM2()
                }
            )

            PSUM2_BETA2 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab('PSUM2_BETA2', PSUM2_BETA2)
            PSUM2_BETA2.graphic.PSUM2_BETA2_graphic()
            PSUM2_BETA2.table.new_tab(
                "PSUM2_BETA2",
                {
                    "PSUM2": PSUM2_BETA2.graphic.excel.PSUM2(),
                    "BETA2": PSUM2_BETA2.graphic.excel.getBETA2()
                }
            )
          
          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:

            self.AreTabsHere3 = True

            PSUM3 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(3).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM3)
            PSUM3.graphic.PSUM3_graphic()
            PSUM3.graphic.remember_method(grap.PSUM3_graphic)
            PSUM3.table.new_tab(
              "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
              {
                  "PSUM3": PSUM3.graphic.excel.PSUM3(),
              }
            )
            PSUM3.remember_tabTable("PSUM3", "PSUM3", PSUM3.graphic.excel.PSUM3())

            PSUM3_GAM3 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab('PSUM3_GAM3', PSUM3_GAM3)
            PSUM3_GAM3.graphic.PSUM3_GAM3_graphic()
            PSUM3_GAM3.table.new_tab(
                "PSUM3_GAM3",
                {
                    "PSUM3": PSUM3_GAM3.graphic.excel.PSUM3(),
                    "GAM3": PSUM3_GAM3.graphic.excel.getGAM3()
                }
            )

            PSUM3_BETA3 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab('PSUM3_BETA3', PSUM3_BETA3)
            PSUM3_BETA3.graphic.PSUM3_BETA3_graphic()
            PSUM3_BETA3.table.new_tab(
                "PSUM3_BETA3",
                {
                    "PSUM3": PSUM3_BETA3.graphic.excel.PSUM3(),
                    "BETA3": PSUM3_BETA3.graphic.excel.getBETA3()
                }
            )

          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:

            self.AreTabsHere4 = True

            PSUM4 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(4).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM4)
            PSUM4.graphic.PSUM4_graphic()
            PSUM4.graphic.remember_method(grap.PSUM4_graphic)
            PSUM4.table.new_tab(
              "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
              {
                  "PSUM4": PSUM4.graphic.excel.PSUM4(),
              }
            )
            PSUM4.remember_tabTable("PSUM4", "PSUM4", PSUM4.graphic.excel.PSUM4())

            PSUM4_GAM4 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab('PSUM4_GAM4', PSUM4_GAM4)
            PSUM4_GAM4.graphic.PSUM4_GAM4_graphic()
            PSUM4_GAM4.table.new_tab(
                "PSUM4_GAM4",
                {
                    "PSUM4": PSUM4_GAM4.graphic.excel.PSUM4(),
                    "GAM4": PSUM4_GAM4.graphic.excel.getGAM4()
                }
            )

            PSUM4_BETA4 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab('PSUM4_BETA4', PSUM4_BETA4)
            PSUM4_BETA4.graphic.PSUM4_BETA4_graphic()
            PSUM4_BETA4.table.new_tab(
                "PSUM4_BETA4",
                {
                    "PSUM4": PSUM4_BETA4.graphic.excel.PSUM4(),
                    "BETA4": PSUM4_BETA4.graphic.excel.getBETA4()
                }
            )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5
            and (self.engine == 'L4' or self.engine == 'V8'
                or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "specific loads"):
          
          self.AreTabsHere5 = True

          PSUM5 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(5).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM5)
          PSUM5.graphic.PSUM5_graphic()
          PSUM5.graphic.remember_method(grap.PSUM5_graphic)
          PSUM5.table.new_tab(
            "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
            {
                "PSUM5": PSUM5.graphic.excel.PSUM5(),
            }
          )
          PSUM5.remember_tabTable("PSUM5", "PSUM5", PSUM5.graphic.excel.PSUM5())

          PSUM5_GAM5 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab('PSUM5_GAM5', PSUM5_GAM5)
          PSUM5_GAM5.graphic.PSUM5_GAM5_graphic()
          PSUM5_GAM5.table.new_tab(
              "PSUM5_GAM5",
              {
                  "PSUM5": PSUM5_GAM5.graphic.excel.PSUM5(),
                  "GAM5": PSUM5_GAM5.graphic.excel.getGAM5()
              }
          )

          PSUM5_BETA5 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab('PSUM5_BETA5', PSUM5_BETA5)
          PSUM5_BETA5.graphic.PSUM5_BETA5_graphic()
          PSUM5_BETA5.table.new_tab(
              "PSUM5_BETA5",
              {
                  "PSUM5": PSUM5_BETA5.graphic.excel.PSUM5(),
                  "BETA5": PSUM5_BETA5.graphic.excel.getBETA5()
              }
          )

        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "specific loads"):
          
          self.AreTabsHere6 = True

          PSUM6 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(6).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM6)
          PSUM6.graphic.PSUM6_graphic()
          PSUM6.graphic.remember_method(grap.PSUM6_graphic)
          PSUM6.table.new_tab(
            "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
            {
                "PSUM6": PSUM6.graphic.excel.PSUM6(),
            }
          )
          PSUM6.remember_tabTable("PSUM6", "PSUM6", PSUM6.graphic.excel.PSUM6())

          PSUM6_GAM6 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab('PSUM6_GAM6', PSUM6_GAM6)
          PSUM6_GAM6.graphic.PSUM6_GAM6_graphic()
          PSUM6_GAM6.table.new_tab(
              "PSUM6_GAM6",
              {
                  "PSUM6": PSUM6_GAM6.graphic.excel.PSUM6(),
                  "GAM6": PSUM6_GAM6.graphic.excel.getGAM6()
              }
          )

          PSUM6_BETA6 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab('PSUM6_BETA6', PSUM6_BETA6)
          PSUM6_BETA6.graphic.PSUM6_BETA6_graphic()
          PSUM6_BETA6.table.new_tab(
              "PSUM6_BETA6",
              {
                  "PSUM6": PSUM6_BETA6.graphic.excel.PSUM6(),
                  "BETA6": PSUM6_BETA6.graphic.excel.getBETA6()
              }
          )

        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "specific loads"):
          
          self.AreTabsHere7 = True
          PSUM7 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(7).add_tab("SPECIFIC LOAD (MPa)  -  CRANK ANGLE", PSUM7)
          PSUM7.graphic.PSUM7_graphic()
          PSUM7.graphic.remember_method(grap.PSUM7_graphic)
          PSUM7.table.new_tab(
            "SPECIFIC LOAD (MPa)  -  CRANK ANGLE",
            {
                "PSUM7": PSUM7.graphic.excel.PSUM7(),
            }
          )
          PSUM7.remember_tabTable("PSUM7", "PSUM7", PSUM7.graphic.excel.PSUM7())

          PSUM7_GAM7 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab('PSUM7_GAM7', PSUM7_GAM7)
          PSUM7_GAM7.graphic.PSUM7_GAM7_graphic()
          PSUM7_GAM7.table.new_tab(
              "PSUM7_GAM7",
              {
                  "PSUM7": PSUM7_GAM7.graphic.excel.PSUM7(),
                  "GAM7": PSUM7_GAM7.graphic.excel.getGAM7()
              }
          )

          PSUM7_BETA7 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab('PSUM7_BETA7', PSUM7_BETA7)
          PSUM7_BETA7.graphic.PSUM7_BETA7_graphic()
          PSUM7_BETA7.table.new_tab(
              "PSUM7_BETA7",
              {
                  "PSUM7": PSUM7_BETA7.graphic.excel.PSUM7(),
                  "BETA7": PSUM7_BETA7.graphic.excel.getBETA7()
              }
          )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere8
            and (self.engine == 'L3' or self.engine == 'V6')
            and self.tabWidget.widget(5).target == "specific loads"):
          print('HERE')
          self.AreTabsHere8 = True

          FMAX_base = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("specific loads", FMAX_base)
          FMAX_base.graphic.FMAX_base()
          FSUM = list()
          FSUM1 = list()
          FSUM2 = list()
          FSUM3 = list()
          FSUM4 = list()
          FSUM = [max(FMAX_base.graphic.excel.PSUM())]
          FSUM1 = [max(FMAX_base.graphic.excel.PSUM1())]
          FSUM2 = [max(FMAX_base.graphic.excel.PSUM2())]
          FSUM3 = [max(FMAX_base.graphic.excel.PSUM3())]
          FSUM4 = [max(FMAX_base.graphic.excel.PSUM4())]
          FMAX_base.table.new_tab(
            "specific loads",
            {
                "PSUM": FSUM,
                "PSUM1": FSUM1,
                "PSUM2": FSUM2,
                "PSUM3": FSUM3,
                "PSUM4": FSUM4,
            }
          )
        
        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere9
            and (self.engine == 'L4' or self.engine == 'V8')
            and self.tabWidget.widget(6).target == "specific loads"):
            # print('HERE')
            self.AreTabsHere9 = True
            FMAX_l4_v8 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(6).add_tab("specific loads", FMAX_l4_v8)
            FMAX_l4_v8.graphic.FMAX_l4_v8()
            FSUM = list()
            FSUM1 = list()
            FSUM2 = list()
            FSUM3 = list()
            FSUM4 = list()
            FSUM5 = list()
            FSUM = [max(FMAX_l4_v8.graphic.excel.PSUM())]
            FSUM1 = [max(FMAX_l4_v8.graphic.excel.PSUM1())]
            FSUM2 = [max(FMAX_l4_v8.graphic.excel.PSUM2())]
            FSUM3 = [max(FMAX_l4_v8.graphic.excel.PSUM3())]
            FSUM4 = [max(FMAX_l4_v8.graphic.excel.PSUM4())]
            FSUM5 = [max(FMAX_l4_v8.graphic.excel.PSUM5())]
            FMAX_l4_v8.table.new_tab(
              "specific loads",
              {
                  "PSUM": FSUM,
                  "PSUM1": FSUM1,
                  "PSUM2": FSUM2,
                  "PSUM3": FSUM3,
                  "PSUM4": FSUM4,
                  "PSUM5": FSUM5,
              }
            )
        if (self.tabWidget.currentIndex() == 8
            and not self.AreTabsHere10
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(8).target == "specific loads"):
            
            self.AreTabsHere10 = True

            FMAX_l6_v12 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(8).add_tab("specific loads", FMAX_l6_v12)
            FMAX_l6_v12.graphic.FMAX_l6_v12()
            FSUM = list()
            FSUM1 = list()
            FSUM2 = list()
            FSUM3 = list()
            FSUM4 = list()
            FSUM5 = list()
            FSUM6 = list()
            FSUM7 = list()
            FSUM = [max(FMAX_l6_v12.graphic.excel.PSUM())]
            FSUM1 = [max(FMAX_l6_v12.graphic.excel.PSUM1())]
            FSUM2 = [max(FMAX_l6_v12.graphic.excel.PSUM2())]
            FSUM3 = [max(FMAX_l6_v12.graphic.excel.PSUM3())]
            FSUM4 = [max(FMAX_l6_v12.graphic.excel.PSUM4())]
            FSUM5 = [max(FMAX_l6_v12.graphic.excel.PSUM5())]
            FSUM6 = [max(FMAX_l6_v12.graphic.excel.PSUM6())]
            FSUM7 = [max(FMAX_l6_v12.graphic.excel.PSUM7())]
            FMAX_l6_v12.table.new_tab(
              "specific loads",
              {
                  "PSUM": FSUM,
                  "PSUM1": FSUM1,
                  "PSUM2": FSUM2,
                  "PSUM3": FSUM3,
                  "PSUM4": FSUM4,
                  "PSUM5": FSUM5,
                  "PSUM6": FSUM6,
                  "PSUM7": FSUM7,
              }
            )
        if (self.tabWidget.widget(0).target == "Pressure"):
          
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True

            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            dm_ = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_)
            dm_.graphic.dm_graphic()
            dm_.table.new_tab(
              "dm",
              {
                  "dm": dm_.graphic.excel.dm(),
              }
            )

            dm_ugm = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab("PRESSURE DIAGRAM - Bearing angle", dm_ugm)
            dm_ugm.graphic.dm_ugm()
            dm_ugm.table.new_tab(
              "dm_ugm",
              {
                  "dm": dm_ugm.graphic.excel.dm(),
                  "ugm": dm_ugm.graphic.excel.ugm(),
              }
            )

            dm_ugw = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(0).add_tab("PRESSURE DIAGRAM - Shaft angle", dm_ugw)
            dm_ugw.graphic.dm_ugw()
            dm_ugw.table.new_tab(
              "dm_ugw",
              {
                  "dm": dm_ugw.graphic.excel.dm(),
                  "ugw": dm_ugw.graphic.excel.ugw(),
              }
            )

            dm_ugm_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm_ugm_cartesian)
            dm_ugm_cartesian.graphic.dm_ugm_cartesian_graphic()
            dm_ugm_cartesian.table.new_tab(
              "dm_ugm_cartesian",
              {
                  "dm": dm_ugm_cartesian.graphic.excel.dm(),
                  "ugm": dm_ugm_cartesian.graphic.excel.ugm(),
              }
            )

            dm_ugw_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(0).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm_ugw_cartesian)
            dm_ugw_cartesian.graphic.dm_ugw_cartesian_graphic()
            dm_ugw_cartesian.table.new_tab(
              "dm_ugw_cartesian",
              {
                  "dm": dm_ugw_cartesian.graphic.excel.dm(),
                  "ugw": dm_ugw_cartesian.graphic.excel.ugw(),
              }
            )

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            
            self.AreTabsHere1 = True

            dm_1 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_1)
            dm_1.graphic.dm1_graphic()
            dm_1.table.new_tab(
              "dm1",
              {
                  "dm1": dm_1.graphic.excel.dm1(),
              }
            )

            dm1_ugm1 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab("PRESSURE DIAGRAM - Bearing angle", dm1_ugm1)
            dm1_ugm1.graphic.dm1_ugm1()
            dm1_ugm1.table.new_tab(
              "dm1_ugm1",
              {
                  "dm1": dm1_ugm1.graphic.excel.dm1(),
                  "ugm1": dm1_ugm1.graphic.excel.ugm1(),
              }
            )

            dm1_ugw1 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(1).add_tab("PRESSURE DIAGRAM - Shaft angle", dm1_ugw1)
            dm1_ugw1.graphic.dm1_ugw1()
            dm1_ugw1.table.new_tab(
              "dm1_ugw1",
              {
                  "dm1": dm1_ugw1.graphic.excel.dm1(),
                  "ugw1": dm1_ugw1.graphic.excel.ugw1(),
              }
            )

            dm1_ugm1_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm1_ugm1_cartesian)
            dm1_ugm1_cartesian.graphic.dm1_ugm1_cartesian_graphic()
            dm1_ugm1_cartesian.table.new_tab(
              "dm1_ugm1_cartesian",
              {
                  "dm1": dm1_ugm1_cartesian.graphic.excel.dm1(),
                  "ugm1": dm1_ugm1_cartesian.graphic.excel.ugm1(),
              }
            )

            dm1_ugw1_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(1).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm1_ugw1_cartesian)
            dm1_ugw1_cartesian.graphic.dm1_ugw1_cartesian_graphic()
            dm1_ugw1_cartesian.table.new_tab(
              "dm1_ugw1_cartesian",
              {
                  "dm1": dm1_ugw1_cartesian.graphic.excel.dm1(),
                  "ugw1": dm1_ugw1_cartesian.graphic.excel.ugw1(),
              }
            )

          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            
            self.AreTabsHere2 = True
            
            dm_2 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_2)
            dm_2.graphic.dm2_graphic()
            dm_2.table.new_tab(
              "dm2",
              {
                  "dm2": dm_2.graphic.excel.dm2(),
              }
            )

            dm2_ugm2 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab("PRESSURE DIAGRAM - Bearing angle", dm2_ugm2)
            dm2_ugm2.graphic.dm2_ugm2()
            dm2_ugm2.table.new_tab(
              "dm2_ugm2",
              {
                  "dm2": dm2_ugm2.graphic.excel.dm2(),
                  "ugm2": dm2_ugm2.graphic.excel.ugm2(),
              }
            )

            dm2_ugw2 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(2).add_tab("PRESSURE DIAGRAM - Shaft angle", dm2_ugw2)
            dm2_ugw2.graphic.dm2_ugw2()
            dm2_ugw2.table.new_tab(
              "dm2_ugw2",
              {
                  "dm2": dm2_ugw2.graphic.excel.dm2(),
                  "ugw2": dm2_ugw2.graphic.excel.ugw2(),
              }
            )

            dm2_ugm2_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm2_ugm2_cartesian)
            dm2_ugm2_cartesian.graphic.dm2_ugm2_cartesian_graphic()
            dm2_ugm2_cartesian.table.new_tab(
              "dm2_ugm2_cartesian",
              {
                  "dm2": dm2_ugm2_cartesian.graphic.excel.dm2(),
                  "ugm2": dm2_ugm2_cartesian.graphic.excel.ugm2(),
              }
            )

            dm2_ugw2_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(2).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm2_ugw2_cartesian)
            dm2_ugw2_cartesian.graphic.dm2_ugw2_cartesian_graphic()
            dm2_ugw2_cartesian.table.new_tab(
              "dm2_ugw2_cartesian",
              {
                  "dm2": dm2_ugw2_cartesian.graphic.excel.dm2(),
                  "ugw2": dm2_ugw2_cartesian.graphic.excel.ugw2(),
              }
            )

          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            
            self.AreTabsHere3 = True

            dm_3 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_3)
            dm_3.graphic.dm3_graphic()
            dm_3.table.new_tab(
              "dm3",
              {
                  "dm3": dm_3.graphic.excel.dm3(),
              }
            )

            dm3_ugm3 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab("PRESSURE DIAGRAM - Bearing angle", dm3_ugm3)
            dm3_ugm3.graphic.dm3_ugm3()
            dm3_ugm3.table.new_tab(
              "dm3_ugm3",
              {
                  "dm3": dm3_ugm3.graphic.excel.dm3(),
                  "ugm3": dm3_ugm3.graphic.excel.ugm3(),
              }
            )

            dm3_ugw3 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(3).add_tab("PRESSURE DIAGRAM - Shaft angle", dm3_ugw3)
            dm3_ugw3.graphic.dm3_ugw3()
            dm3_ugw3.table.new_tab(
              "dm3_ugw3",
              {
                  "dm3": dm3_ugw3.graphic.excel.dm3(),
                  "ugw3": dm3_ugw3.graphic.excel.ugw3(),
              }
            )

            dm3_ugm3_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm3_ugm3_cartesian)
            dm3_ugm3_cartesian.graphic.dm3_ugm3_cartesian_graphic()
            dm3_ugm3_cartesian.table.new_tab(
              "dm3_ugm3_cartesian",
              {
                  "dm3": dm3_ugm3_cartesian.graphic.excel.dm3(),
                  "ugm3": dm3_ugm3_cartesian.graphic.excel.ugm3(),
              }
            )

            dm3_ugw3_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(3).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm3_ugw3_cartesian)
            dm3_ugw3_cartesian.graphic.dm3_ugw3_cartesian_graphic()
            dm3_ugw3_cartesian.table.new_tab(
              "dm3_ugw3_cartesian",
              {
                  "dm3": dm3_ugw3_cartesian.graphic.excel.dm3(),
                  "ugw3": dm3_ugw3_cartesian.graphic.excel.ugw3(),
              }
            )
          
          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            
            self.AreTabsHere4 = True

            dm_4 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_4)
            dm_4.graphic.dm4_graphic()
            dm_4.table.new_tab(
              "dm4",
              {
                  "dm4": dm_4.graphic.excel.dm4(),
              }
            )

            dm4_ugm4 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab("PRESSURE DIAGRAM - Bearing angle", dm4_ugm4)
            dm4_ugm4.graphic.dm4_ugm4()
            dm4_ugm4.table.new_tab(
              "dm4_ugm4",
              {
                  "dm4": dm4_ugm4.graphic.excel.dm4(),
                  "ugm4": dm4_ugm4.graphic.excel.ugm4(),
              }
            )

            dm4_ugw4 = MainWidget(self.path_to_res, 'polar')
            self.tabWidget.widget(4).add_tab("PRESSURE DIAGRAM - Shaft angle", dm4_ugw4)
            dm4_ugw4.graphic.dm4_ugw4()
            dm4_ugw4.table.new_tab(
              "dm4_ugw4",
              {
                  "dm4": dm4_ugw4.graphic.excel.dm4(),
                  "ugw4": dm4_ugw4.graphic.excel.ugw4(),
              }
            )

            dm4_ugm4_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm4_ugm4_cartesian)
            dm4_ugm4_cartesian.graphic.dm4_ugm4_cartesian_graphic()
            dm4_ugm4_cartesian.table.new_tab(
              "dm4_ugm4_cartesian",
              {
                  "dm4": dm4_ugm4_cartesian.graphic.excel.dm4(),
                  "ugm4": dm4_ugm4_cartesian.graphic.excel.ugm4(),
              }
            )

            dm4_ugw4_cartesian = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(4).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm4_ugw4_cartesian)
            dm4_ugw4_cartesian.graphic.dm4_ugw4_cartesian_graphic()
            dm4_ugw4_cartesian.table.new_tab(
              "dm4_ugw4_cartesian",
              {
                  "dm4": dm4_ugw4_cartesian.graphic.excel.dm4(),
                  "ugw4": dm4_ugw4_cartesian.graphic.excel.ugw4(),
              }
            )

        if (self.tabWidget.currentIndex() == 5
          and not self.AreTabsHere5
          and (self.engine == 'L4' or self.engine == 'V8'
              or self.engine == 'L6' or self.engine == 'V12')
          and self.tabWidget.widget(5).target == "Pressure"):
            
          self.AreTabsHere5 = True

          dm_5 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_5)
          dm_5.graphic.dm5_graphic()
          dm_5.table.new_tab(
            "dm5",
            {
                "dm5": dm_5.graphic.excel.dm5(),
            }
          )

          dm5_ugm5 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab("PRESSURE DIAGRAM - Bearing angle", dm5_ugm5)
          dm5_ugm5.graphic.dm5_ugm5()
          dm5_ugm5.table.new_tab(
            "dm5_ugm5",
            {
                "dm5": dm5_ugm5.graphic.excel.dm5(),
                "ugm5": dm5_ugm5.graphic.excel.ugm5(),
            }
          )

          dm5_ugw5 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(5).add_tab("PRESSURE DIAGRAM - Shaft angle", dm5_ugw5)
          dm5_ugw5.graphic.dm5_ugw5()
          dm5_ugw5.table.new_tab(
            "dm5_ugw5",
            {
                "dm5": dm5_ugw5.graphic.excel.dm5(),
                "ugw5": dm5_ugw5.graphic.excel.ugw5(),
            }
          )

          dm5_ugm5_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm5_ugm5_cartesian)
          dm5_ugm5_cartesian.graphic.dm5_ugm5_cartesian_graphic()
          dm5_ugm5_cartesian.table.new_tab(
              "dm5_ugm5_cartesian",
              {
                "dm5": dm5_ugm5_cartesian.graphic.excel.dm5(),
                "ugm5": dm5_ugm5_cartesian.graphic.excel.ugm5(),
              }
          )

          dm5_ugw5_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm5_ugw5_cartesian)
          dm5_ugw5_cartesian.graphic.dm_ugw_cartesian_graphic()
          dm5_ugw5_cartesian.table.new_tab(
              "dm5_ugw5_cartesian",
              {
                "dm5": dm5_ugw5_cartesian.graphic.excel.dm5(),
                "ugw5": dm5_ugw5_cartesian.graphic.excel.ugw5(),
              }
          )

        if (self.tabWidget.currentIndex() == 6
          and not self.AreTabsHere6
          and (self.engine == 'L6' or self.engine == 'V12')
          and self.tabWidget.widget(6).target == "Pressure"):
            
          self.AreTabsHere6 = True

          dm_6 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_6)
          dm_6.graphic.dm6_graphic()
          dm_6.table.new_tab(
            "dm6",
            {
                "dm6": dm_6.graphic.excel.dm6(),
            }
          )

          dm6_ugm6 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab("PRESSURE DIAGRAM - Bearing angle", dm6_ugm6)
          dm6_ugm6.graphic.dm6_ugm6()
          dm6_ugm6.table.new_tab(
            "dm6_ugm6",
            {
                "dm6": dm6_ugm6.graphic.excel.dm6(),
                "ugm6": dm6_ugm6.graphic.excel.ugm6(),
            }
          )

          dm6_ugw6 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(6).add_tab("PRESSURE DIAGRAM - Shaft angle", dm6_ugw6)
          dm6_ugw6.graphic.dm6_ugw6()
          dm6_ugw6.table.new_tab(
            "dm6_ugw6",
            {
                "dm6": dm6_ugw6.graphic.excel.dm6(),
                "ugw6": dm6_ugw6.graphic.excel.ugw6(),
            }
          )

          dm6_ugm6_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm6_ugm6_cartesian)
          dm6_ugm6_cartesian.graphic.dm6_ugm6_cartesian_graphic()
          dm6_ugm6_cartesian.table.new_tab(
              "dm6_ugm6_cartesian",
              {
                "dm6": dm6_ugm6_cartesian.graphic.excel.dm6(),
                "ugm6": dm6_ugm6_cartesian.graphic.excel.ugm6(),
              }
          )

          dm6_ugw6_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(6).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm6_ugw6_cartesian)
          dm6_ugw6_cartesian.graphic.dm6_ugw6_cartesian_graphic()
          dm6_ugw6_cartesian.table.new_tab(
              "dm6_ugw6_cartesian",
              {
                "dm6": dm6_ugw6_cartesian.graphic.excel.dm6(),
                "ugw6": dm6_ugw6_cartesian.graphic.excel.ugw6(),
              }
          )

        if (self.tabWidget.currentIndex() == 7
          and not self.AreTabsHere7
          and (self.engine == 'L6' or self.engine == 'V12')
          and self.tabWidget.widget(7).target == "Pressure"):
            
          self.AreTabsHere7 = True

          dm_7 = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("MAX. OIL FILM PRESSURE vs Crank angle", dm_7)
          dm_7.graphic.dm7_graphic()
          dm_7.table.new_tab(
            "dm7",
            {
                "dm7": dm_7.graphic.excel.dm7(),
            }
          )

          dm7_ugm7 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab("PRESSURE DIAGRAM - Bearing angle", dm7_ugm7)
          dm7_ugm7.graphic.dm7_ugm7()
          dm7_ugm7.table.new_tab(
            "dm7_ugm7",
            {
                "dm7": dm7_ugm7.graphic.excel.dm7(),
                "ugm7": dm7_ugm7.graphic.excel.ugm7(),
            }
          )

          dm7_ugw7 = MainWidget(self.path_to_res, 'polar')
          self.tabWidget.widget(7).add_tab("PRESSURE DIAGRAM - Shaft angle", dm7_ugw7)
          dm7_ugw7.graphic.dm7_ugw7()
          dm7_ugw7.table.new_tab(
            "dm7_ugw7",
            {
                "dm7": dm7_ugw7.graphic.excel.dm7(),
                "ugw7": dm7_ugw7.graphic.excel.ugw7(),
            }
          )

          dm7_ugm7_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle", dm7_ugm7_cartesian)
          dm7_ugm7_cartesian.graphic.dm7_ugm7_cartesian_graphic()
          dm7_ugm7_cartesian.table.new_tab(
              "dm7_ugm7_cartesian",
              {
                "dm7": dm7_ugm7_cartesian.graphic.excel.dm7(),
                "ugm7": dm7_ugm7_cartesian.graphic.excel.ugm7(),
              }
          )

          dm7_ugw7_cartesian = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(7).add_tab("PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle", dm7_ugw7_cartesian)
          dm7_ugw7_cartesian.graphic.dm7_ugw7_cartesian_graphic()
          dm7_ugw7_cartesian.table.new_tab(
              "dm7_ugw7_cartesian",
              {
                "dm7": dm7_ugm7_cartesian.graphic.excel.dm7(),
                "ugw7": dm7_ugm7_cartesian.graphic.excel.ugw7(),
              }
          )

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere8
            and (self.engine == 'L3' or self.engine == 'V6')
            and self.tabWidget.widget(5).target == "Pressure"):
          print('HERE')
          self.AreTabsHere8 = True

          dm_base = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Суммарная диаграмма максимального давления", dm_base)
          dm_base.graphic.dm_base()
          dm = list()
          dm1 = list()
          dm2 = list()
          dm3 = list()
          dm4 = list()
          dm = [max(dm_base.graphic.excel.dm())]
          dm1 = [max(dm_base.graphic.excel.dm1())]
          dm2 = [max(dm_base.graphic.excel.dm2())]
          dm3 = [max(dm_base.graphic.excel.dm3())]
          dm4 = [max(dm_base.graphic.excel.dm4())]
          dm_base.table.new_tab(
            "Максимальные давления масляных пленок для всех подшипников",
            {
                "dm": dm,
                "dm1": dm1,
                "dm2": dm2,
                "dm3": dm3,
                "dm4": dm4,
            }
          )
        
        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere9
            and (self.engine == 'L4' or self.engine == 'V8')
            and self.tabWidget.widget(6).target == "Pressure"):
            # print('HERE')
            self.AreTabsHere9 = True
            dm_l4_v8 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(6).add_tab("Суммарная диаграмма максимального давления", dm_l4_v8)
            dm_l4_v8.graphic.dm_l4_v8()
            dm = list()
            dm1 = list()
            dm2 = list()
            dm3 = list()
            dm4 = list()
            dm5 = list()
            dm = [max(dm_l4_v8.graphic.excel.dm())]
            dm1 = [max(dm_l4_v8.graphic.excel.dm1())]
            dm2 = [max(dm_l4_v8.graphic.excel.dm2())]
            dm3 = [max(dm_l4_v8.graphic.excel.dm3())]
            dm4 = [max(dm_l4_v8.graphic.excel.dm4())]
            dm5 = [max(dm_l4_v8.graphic.excel.dm5())]
            dm_l4_v8.table.new_tab(
              "Максимальные давления мин. масляных пленок для всех подшипников",
              {
                  "dm": dm,
                  "dm1": dm1,
                  "dm2": dm2,
                  "dm3": dm3,
                  "dm4": dm4,
                  "dm5": dm5,
              }
            )

        if (self.tabWidget.currentIndex() == 8
            and not self.AreTabsHere10
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(8).target == "Pressure"):
            
            self.AreTabsHere10 = True

            dm_l6_v12 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(8).add_tab("Суммарная диаграмма максимального давления", dm_l6_v12)
            dm_l6_v12.graphic.dm_l6_v12()
            dm = list()
            dm1 = list()
            dm2 = list()
            dm3 = list()
            dm4 = list()
            dm5 = list()
            dm6 = list()
            dm7 = list()
            dm = [max(dm_l6_v12.graphic.excel.dm())]
            dm1 = [max(dm_l6_v12.graphic.excel.dm1())]
            dm2 = [max(dm_l6_v12.graphic.excel.dm2())]
            dm3 = [max(dm_l6_v12.graphic.excel.dm3())]
            dm4 = [max(dm_l6_v12.graphic.excel.dm4())]
            dm5 = [max(dm_l6_v12.graphic.excel.dm5())]
            dm6 = [max(dm_l6_v12.graphic.excel.dm6())]
            dm7 = [max(dm_l6_v12.graphic.excel.dm7())]
            dm_l6_v12.table.new_tab(
              "Максимальные давления мин. масляных пленок для всех подшипников",
              {
                  "dm": dm,
                  "dm1": dm1,
                  "dm2": dm2,
                  "dm3": dm3,
                  "dm4": dm4,
                  "dm5": dm5,
                  "dm6": dm6,
                  "dm7": dm7,
              }
            )

        if (self.tabWidget.widget(0).target == "Losses"):
          
          if self.tabWidget.currentIndex() == 0 and not self.AreTabsHere and self.AreChildren:

            self.AreTabsHere = True

            if self.expert.mode == 1:
              self.pattern = f"{f'data'}/*{'_res.xlsx'}*"
            if self.expert.mode == 2:
              self.pattern = f"{f'data/mode1'}/*{'_res.xlsx'}*"
            if self.expert.mode == 3:
              self.pattern = f"{f'data/mode2'}/*{'_res.xlsx'}*"
            if self.expert.mode == 4:
              self.pattern = f"{f'data/mode3'}/*{'_res.xlsx'}*"
            self.path_to_res =  glob.glob(self.pattern)[0]

            TN = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(0).add_tab("POWER LOSS", TN)
            TN.graphic.TN_graphic()
            TN.graphic.remember_method(grap.TN_graphic)
            TN.table.new_tab(
              "TN",
              {
                  "TN": TN.graphic.excel.TN(),
              }
            )
            TN.remember_tabTable("TN", "TN", TN.graphic.excel.TN())

          elif self.tabWidget.currentIndex() == 1 and not self.AreTabsHere1:
            
            self.AreTabsHere1 = True

            TN1 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(1).add_tab("POWER LOSS", TN1)
            TN1.graphic.TN1_graphic()
            TN1.graphic.remember_method(grap.TN1_graphic)
            TN1.table.new_tab(
              "TN1",
              {
                  "TN1": TN1.graphic.excel.TN1(),
              }
            )
            TN1.remember_tabTable("TN1", "TN1", TN1.graphic.excel.TN1())


          elif self.tabWidget.currentIndex() == 2 and not self.AreTabsHere2:
            
            self.AreTabsHere2 = True

            TN2 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(2).add_tab("POWER LOSS", TN2)
            TN2.graphic.TN2_graphic()
            TN2.graphic.remember_method(grap.TN2_graphic)
            TN2.table.new_tab(
              "TN2",
              {
                  "TN2": TN2.graphic.excel.TN2(),
              }
            )
            TN2.remember_tabTable("TN2", "TN2", TN2.graphic.excel.TN2())

          
          elif self.tabWidget.currentIndex() == 3 and not self.AreTabsHere3:
            
            self.AreTabsHere3 = True

            TN3 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(3).add_tab("POWER LOSS", TN3)
            TN3.graphic.TN3_graphic()
            TN3.graphic.remember_method(grap.TN3_graphic)
            TN3.table.new_tab(
              "TN3",
              {
                  "TN3": TN3.graphic.excel.TN3(),
              }
            )
            TN3.remember_tabTable("TN3", "TN3", TN3.graphic.excel.TN3())


          elif self.tabWidget.currentIndex() == 4 and not self.AreTabsHere4:
            
            self.AreTabsHere4 = True

            TN4 = MainWidget(self.path_to_res, 'cartesian')
            grap = Graphics(self.path_to_res, 1)
            self.tabWidget.widget(4).add_tab("POWER LOSS", TN4)
            TN4.graphic.TN4_graphic()
            TN4.graphic.remember_method(grap.TN4_graphic)
            TN4.table.new_tab(
              "TN4",
              {
                  "TN4": TN4.graphic.excel.TN4(),
              }
            )
            TN4.remember_tabTable("TN4", "TN4", TN4.graphic.excel.TN4())

        
        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere5
            and (self.engine == 'L4' or self.engine == 'V8'
              or self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(5).target == "Losses"):
          
          self.AreTabsHere5 = True

          TN5 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(5).add_tab("POWER LOSS", TN5)
          TN5.graphic.TN5_graphic()
          TN5.graphic.remember_method(grap.TN5_graphic)
          TN5.table.new_tab(
            "TN5",
            {
                "TN5": TN5.graphic.excel.TN5(),
            }
          )
          TN5.remember_tabTable("TN5", "TN", TN5.graphic.excel.TN5())


        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere6
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(6).target == "Losses"):
          
          self.AreTabsHere6 = True

          TN6 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(6).add_tab("POWER LOSS", TN6)
          TN6.graphic.TN6_graphic()
          TN6.graphic.remember_method(grap.TN6_graphic)
          TN6.table.new_tab(
            "TN6",
            {
                "TN6": TN6.graphic.excel.TN6(),
            }
          )
          TN6.remember_tabTable("TN6", "TN6", TN6.graphic.excel.TN6())


        if (self.tabWidget.currentIndex() == 7
            and not self.AreTabsHere7
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(7).target == "Losses"):
          
          self.AreTabsHere7 = True

          TN7 = MainWidget(self.path_to_res, 'cartesian')
          grap = Graphics(self.path_to_res, 1)
          self.tabWidget.widget(7).add_tab("POWER LOSS", TN7)
          TN7.graphic.TN7_graphic()
          TN7.graphic.remember_method(grap.TN7_graphic)
          TN7.table.new_tab(
            "TN7",
            {
                "TN7": TN7.graphic.excel.TN7(),
            }
          )
          TN7.remember_tabTable("TN7", "TN7", TN7.graphic.excel.TN7())

        if (self.tabWidget.currentIndex() == 5
            and not self.AreTabsHere8
            and (self.engine == 'L3' or self.engine == 'V6')
            and self.tabWidget.widget(5).target == "Losses"):
  
          self.AreTabsHere8 = True

          TN_base = MainWidget(self.path_to_res, 'cartesian1')
          self.tabWidget.widget(5).add_tab("Суммарная диаграмма потерь на трение", TN_base)
          TN_base.graphic.TN_base()
          TN = list()
          TN1 = list()
          TN2 = list()
          TN3 = list()
          TN4 = list()
          TN = [mean(TN_base.graphic.excel.TN())]
          TN1 = [mean(TN_base.graphic.excel.TN1())]
          TN2 = [mean(TN_base.graphic.excel.TN2())]
          TN3 = [mean(TN_base.graphic.excel.TN3())]
          TN4 = [mean(TN_base.graphic.excel.TN4())]
          TN_base.table.new_tab(
            "Средние потери на трение для всех подшипников",
            {
                "TN": TN,
                "TN1": TN1,
                "TN2": TN2,
                "TN3": TN3,
                "TN4": TN4,
            }
          )
        
        if (self.tabWidget.currentIndex() == 6
            and not self.AreTabsHere9
            and (self.engine == 'L4' or self.engine == 'V8')
            and self.tabWidget.widget(6).target == "Losses"):

            self.AreTabsHere9 = True
            TN_l4_v8 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(6).add_tab("Суммарная диаграмма потерь на трение", TN_l4_v8)
            TN_l4_v8.graphic.TN_l4_v8()
            TN = list()
            TN1 = list()
            TN2 = list()
            TN3 = list()
            TN4 = list()
            TN5 = list()
            TN = [mean(TN_l4_v8.graphic.excel.TN())]
            TN1 = [mean(TN_l4_v8.graphic.excel.TN1())]
            TN2 = [mean(TN_l4_v8.graphic.excel.TN2())]
            TN3 = [mean(TN_l4_v8.graphic.excel.TN3())]
            TN4 = [mean(TN_l4_v8.graphic.excel.TN4())]
            TN5 = [mean(TN_l4_v8.graphic.excel.TN5())]
            TN_l4_v8.table.new_tab(
              "Средние потери на трение для всех подшипников",
              {
                  "TN": TN,
                  "TN1": TN1,
                  "TN2": TN2,
                  "TN3": TN3,
                  "TN4": TN4,
                  "TN5": TN5,
              }
            )

        if (self.tabWidget.currentIndex() == 8
            and not self.AreTabsHere10
            and (self.engine == 'L6' or self.engine == 'V12')
            and self.tabWidget.widget(8).target == "Losses"):
            
            self.AreTabsHere10 = True

            TN_l6_v12 = MainWidget(self.path_to_res, 'cartesian1')
            self.tabWidget.widget(8).add_tab("Суммарная диаграмма потерь на трение", TN_l6_v12)
            TN_l6_v12.graphic.TN_l6_v12()
            TN = list()
            TN1 = list()
            TN2 = list()
            TN3 = list()
            TN4 = list()
            TN5 = list()
            TN6 = list()
            TN7 = list()
            TN = [mean(TN_l6_v12.graphic.excel.TN())]
            TN1 = [mean(TN_l6_v12.graphic.excel.TN1())]
            TN2 = [mean(TN_l6_v12.graphic.excel.TN2())]
            TN3 = [mean(TN_l6_v12.graphic.excel.TN3())]
            TN4 = [mean(TN_l6_v12.graphic.excel.TN4())]
            TN5 = [mean(TN_l6_v12.graphic.excel.TN5())]
            TN6 = [mean(TN_l6_v12.graphic.excel.TN6())]
            TN7 = [mean(TN_l6_v12.graphic.excel.TN7())]
            TN_l6_v12.table.new_tab(
              "Средние потери на трение для всех подшипников",
              {
                  "TN": TN,
                  "TN1": TN1,
                  "TN2": TN2,
                  "TN3": TN3,
                  "TN4": TN4,
                  "TN5": TN5,
                  "TN6": TN6,
                  "TN7": TN7,
              }
            )
      except Exception:
        logging.info(traceback.format_exc() + "\n" + "-"*35)
        msg = QMessageBox()
        msg.critical(None, "Ошибка", "Ошибка при построении графика")

   def add_tab(self, title: str, obj) -> None:
    '''Создание вкладки окна'''
    self.tabWidget.addTab(obj, title)

class MiddleMainWidget(QtWidgets.QWidget):
  def __init__(self, target):
      super().__init__()
      # layout = QtWidgets.QVBoxLayout()
      # layout.addWidget(self.MainWidget)
      # self.setLayout(layout)
      self.tabWidget = QtWidgets.QTabWidget()
      self.tabWidget.setCurrentIndex(0)
      self.vbox = QtWidgets.QVBoxLayout()
      self.vbox.addWidget(self.tabWidget)
      self.setLayout(self.vbox)
      self.AreTabsHere = False
      self.target = target

  
  def add_tab(self, title: str, obj) -> None:
    '''Создание вкладки окна'''
    self.tabWidget.addTab(obj, title)
# ГЛАВНЫЙ ВИДЖЕТ, здесь обьединяется таблица и график
class MainWidget(QtWidgets.QWidget):
    def __init__(self, path, name) -> None:
      super().__init__()
      self.flag = 1
      self.table = TabTable()
      if (name == 'polar'):
        self.graphic = PolarGraphics(path)
      elif name == 'cartesian':
        # self.button = QtWidgets.QPushButton("Сдвиг по фазе на 360°")
        # self.button.clicked.connect(lambda: self.phase_shift(path))
        self.graphic = Graphics_children(path)
      else:
         self.graphic = Graphics(path, 1)
      self.layout = QtWidgets.QVBoxLayout()
      self.layout.addWidget(self.graphic)
      # if name == 'cartesian':
      #   self.layout.addWidget(self.button)
      self.layout.addWidget(self.table)
      self.setLayout(self.layout)
      self.target = "mainWidget"

    def phase_shift(self, path):
      if self.flag%2 == 1:
        self.graphic_new = Graphics_children(path)
        self.graphic_new.method = self.graphic.method
        print(self.graphic_new.method)
        self.graphic.deleteLater()
        self.table.deleteLater()
        self.button.deleteLater()
        self.grap = Graphics(path, 1)
        self.table = TabTable()
        self.button = QtWidgets.QPushButton("Сдвиг по фазе на 360°")
        self.button.clicked.connect(lambda: self.phase_shift(path))
        self.table.new_tab(
           self.tabTitle,
           {
              self.nameCol: self.graphic_new.phase_shift_360(self.data)
           }
        )
        self.layout.addWidget(self.graphic_new)
        self.layout.addWidget(self.button)
        self.layout.addWidget(self.table)
        self.graphic_new.method(self.graphic_new, self.graphic_new.phase_shift_360)
      else:
        self.graphic = Graphics_children(path)
        self.graphic.method = self.graphic_new.method
        print(self.graphic.method)
        self.graphic_new.deleteLater()
        self.table.deleteLater()
        self.button.deleteLater()
        self.grap = Graphics(path, 1)
        self.table = TabTable()
        self.button = QtWidgets.QPushButton("Сдвиг по фазе на 360°")
        self.button.clicked.connect(lambda: self.phase_shift(path))
        self.table.new_tab(
           self.tabTitle,
           {
              self.nameCol: self.graphic_new.phase_shift_0(self.data)
           }
        )
        self.layout.addWidget(self.graphic)
        self.layout.addWidget(self.button)
        self.layout.addWidget(self.table)
        self.graphic_new.method(self.graphic, self.graphic.phase_shift_0)
      self.flag+=1
    
    def remember_tabTable(self, title, col, mas):
      self.tabTitle = title
      self.nameCol = col
      self.data = mas
       
class MplCanvas(FigureCanvasQTAgg):
    def __init__(self, parent=None, width=5, height=4, dpi=100) -> None:
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.fig.add_subplot(111)
        super(MplCanvas, self).__init__(self.fig)

class MplPolarCanvas(FigureCanvasQTAgg):
   def __init__(self, parent=None, width=5, height=4, dpi=100) -> None:
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.fig.add_subplot(111, projection='polar')
        super(MplPolarCanvas, self).__init__(self.fig)

def cart2pol(x, y):

    xx = np.array(x)
    yy = np.array(y)

    rho = np.sqrt(xx**2 + yy**2)
    phi = np.arctan2(yy, xx)* 180 / np.pi
    return rho, phi

class PolarGraphics(QtWidgets.QWidget):
  def __init__(self, path):
    super().__init__()
    self.sc = MplPolarCanvas(self, width=5, height=4, dpi=100)
    self.data = Data()
    self.excel = ReadExcel(path)
    self.expert = Expert()
    toolbar = NavigationToolbar(self.sc, self)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(toolbar)
    layout.addWidget(self.sc)
    
    self.setLayout(layout)

  def polar_graphic(self, schedule_forces: list, angle_difference, name: str):

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    # for i in range(len(theta)):

      # theta_first_sector = np.empty(size)
      # theta_second_sector = np.empty(size)
      # theta_third_sector = np.empty(size)
      # theta_fourth_sector = np.empty(size)

      # fval_first_sector = np.empty(size)
      # fval_second_sector = np.empty(size)
      # fval_third_sector = np.empty(size)
      # fval_fourth_sector = np.empty(size)


      # if 0<=angle_difference[i]<=180:
      #   theta_first_sector.append(theta[i])
      #   fval_first_sector.append(schedule_forces[i])

      # elif 180<angle_difference[i]<=360:
      #   theta_second_sector.append(theta[i])
      #   fval_second_sector.append(schedule_forces[i])
      
      # elif 360<angle_difference[i]<=540:
      #   theta_third_sector.append(theta[i])
      #   fval_third_sector.append(schedule_forces[i])

      # elif 540<angle_difference[i]<=720:
      #   theta_fourth_sector.append(theta[i])
      #   fval_fourth_sector.append(schedule_forces[i])

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]
        
    # print('theta_first_sector, fval_first_sector')
    # print(theta_first_sector, fval_first_sector)
    # print('theta_second_sector, fval_second_sector')
    # print(theta_second_sector, fval_second_sector)
    # print('theta_third_sector, fval_third_sector')
    # print(theta_third_sector, fval_third_sector)
    # print('theta_fourth_sector, fval_fourth_sector')
    # print(theta_fourth_sector, fval_fourth_sector)
    patch_theta = list()
    patch_vals = list()

    patch_theta.append(theta_first_sector[-1])
    patch_theta.append(theta_second_sector[0])
    patch_vals.append(fval_first_sector[-1])
    patch_vals.append(fval_second_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'k')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_second_sector[-1])
    patch_theta.append(theta_third_sector[0])
    patch_vals.append(fval_second_sector[-1])
    patch_vals.append(fval_third_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'r')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_third_sector[-1])
    patch_theta.append(theta_fourth_sector[0])
    patch_vals.append(fval_third_sector[-1])
    patch_vals.append(fval_fourth_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'g')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_fourth_sector[-1])
    patch_theta.append(theta_first_sector[0])
    patch_vals.append(fval_fourth_sector[-1])
    patch_vals.append(fval_first_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'b')

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    self.sc.axes.plot(theta1, [radius1 for i in theta1], 'c', label='максимум')
    
    # self.sc.axes.set_rgrids(np.arange(0,20000, 5000))
    self.sc.axes.set_rgrids(np.arange(0, radius1, radius1/5))
    self.sc.axes.set_theta_direction(-1)
    self.sc.axes.set_theta_offset(+0.5*np.pi)

    self.sc.axes.legend(bbox_to_anchor=(1, 0.6))

    self.sc.axes.set_title(name)

  def polar_graphic_FHMIN(self, schedule_forces: list, angle_difference, number=1, target='skor'):
    
    # for i in range(len(schedule_forces)):
    #   schedule_forces[i] = round(1000*schedule_forces[i], 2)

    radius1 = max(schedule_forces)

    if target == "ssch":
      r = float(self.data.excel['ssch'])
    elif target == "skor":
      r = float(self.data.excel['skor'])

    theta1= np.arange(0, 2*np.pi, 0.01)
    
    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    patch_theta = list()
    patch_vals = list()

    patch_theta.append(theta_first_sector[-1])
    patch_theta.append(theta_second_sector[0])
    patch_vals.append(fval_first_sector[-1])
    patch_vals.append(fval_second_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'k')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_second_sector[-1])
    patch_theta.append(theta_third_sector[0])
    patch_vals.append(fval_second_sector[-1])
    patch_vals.append(fval_third_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'r')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_third_sector[-1])
    patch_theta.append(theta_fourth_sector[0])
    patch_vals.append(fval_third_sector[-1])
    patch_vals.append(fval_fourth_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'g')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_fourth_sector[-1])
    patch_theta.append(theta_first_sector[0])
    patch_vals.append(fval_fourth_sector[-1])
    patch_vals.append(fval_first_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'b')

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    # self.sc.axes.plot(theta1, [radius1 for i in theta1], 'c', label='максимум')
    # self.sc.axes.plot(theta1, [1 for i in theta1], 'ffff99', label="диаметральный зазор")
    # self.sc.axes.plot(theta1, [radius1 + radius1/25 for i in theta1], 'c', zorder=2)
    self.sc.axes.spines['polar'].set_visible(True)
    # if number!=0:
    #   begin = self.expert.excel[f'MN{number}Θ1']
    #   end = self.expert.excel[f'MN{number}Θ2']
    #   theta_end = [x*np.pi/180 for x in range(int(end)+1)]
    #   theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
    #   self.sc.axes.plot(theta_end, [(1 +1/25) for i in theta_end], color='#ffff99', linewidth=6, zorder=1, label='канавка')
    #   self.sc.axes.plot(theta_begin, [(1 +1/25) for i in theta_begin], color='#ffff99', linewidth=6, zorder=1)
    #   self.sc.axes.plot(theta_begin[:1], ([(radius1 + radius1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
    #   self.sc.axes.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(radius1 + radius1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
    # else:
    #   begin = 360
    #   end = 0
    
    # if "ugw" in name:
    #    for i in range(len(schedule_forces)):
    #       if (schedule_forces[i] == max(schedule_forces)):
    #          self.sc.axes.plot([theta[i]], [radius1], 'gX', label=f'максимальное давление пленки {max(schedule_forces)}\nугол {angle_difference[i]}°')

    # else:
    #   flag = 1
    #   vals_270_90 = []
    #   vals_90_270 = []
    #   for x in angle_difference:
    #     val = x
    #     if int(x)<0:
    #       x = str(int(x)+360)
    #     if 0<=int(x)<90 or 270<int(x)<450:
    #       vals_270_90.append(schedule_forces[list(angle_difference).index(val)])
    #     else:
    #       vals_90_270.append(schedule_forces[list(angle_difference).index(val)])

    #   for i in range(len(schedule_forces)):
    #       if (len(vals_270_90) and schedule_forces[i] == max(vals_270_90)):
    #          self.sc.axes.plot([theta[i]], [max(vals_270_90)], 'gX', label=f'максимальное давление плёнки в верхнем вкладыше\nдавление: {max(vals_270_90)}\nугол: {angle_difference[i]}°')
    #       elif (len(vals_90_270) and schedule_forces[i] == max(vals_90_270)):
    #          self.sc.axes.plot([theta[i]], [max(vals_90_270)], 'yX', label=f'максимальное давление плёнки в нижнем вкладыше\nдавление: {max(vals_90_270)}\nугол: {angle_difference[i]}°')
      
    # self.sc.axes.plot(theta1, [radius1 for i in theta1], 'g', label='граница')
    
    # self.sc.axes.set_rgrids(np.arange(0,20000, 5000))
             
    # self.sc.axes.set_rgrids(np.arange(0, radius1, radius1/5))
    self.sc.axes.grid(True)
    self.sc.axes.set_theta_direction(-1)
    self.sc.axes.set_theta_offset(+0.5*np.pi)

    # if not flag:
    self.sc.axes.legend(bbox_to_anchor=(1, 0.6))
    # self.sc.axes.plot(0, 0, 'k+')
    # else:
    #   self.sc.axes.legend(bbox_to_anchor=(1, 1))

    self.sc.axes.set_title('MOFT (micron)')

  def polar_graphic_orbit(self, schedule_forces: list, angle_difference, name: str, number=1, target='skor'):

    radius1 = max(schedule_forces)

    if target == "ssch":
      r = float(self.data.excel['ssch'])
    elif target == "skor":
      r = float(self.data.excel['skor'])

    theta1= np.arange(0, 2*np.pi, 0.01)
    
    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    patch_theta = list()
    patch_vals = list()

    patch_theta.append(theta_first_sector[-1])
    patch_theta.append(theta_second_sector[0])
    patch_vals.append(fval_first_sector[-1])
    patch_vals.append(fval_second_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'k')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_second_sector[-1])
    patch_theta.append(theta_third_sector[0])
    patch_vals.append(fval_second_sector[-1])
    patch_vals.append(fval_third_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'r')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_third_sector[-1])
    patch_theta.append(theta_fourth_sector[0])
    patch_vals.append(fval_third_sector[-1])
    patch_vals.append(fval_fourth_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'g')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_fourth_sector[-1])
    patch_theta.append(theta_first_sector[0])
    patch_vals.append(fval_fourth_sector[-1])
    patch_vals.append(fval_first_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'b')

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    # self.sc.axes.plot(theta1, [1 for i in theta1], 'ffff99', label="диаметральный зазор")
    self.sc.axes.plot(theta1, [1 for i in theta1], 'c', zorder=2)
    self.sc.axes.spines['polar'].set_visible(False)
    if number!=0:
      begin = self.data.excel[f'MN{number}01']
      end = self.data.excel[f'MN{number}02']

      if int(begin) < 0:
        begin = int(begin) + 360
      elif int(end) < 0:
        end = int(end) + 360

      if int(begin) > int(end):
        theta_end = [x*np.pi/180 for x in range(int(end)+1)]
        theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
        self.sc.axes.plot(theta_end, [(1 + 1/25) for i in theta_end], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta_begin, [(1 + 1/25) for i in theta_begin], color='#ffff99', linewidth=6, zorder=1,)
        self.sc.axes.plot(theta_begin[:1], ([(1 + 1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(1 + 1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
      
      elif int(begin) < int(end):
        theta2 = [x*np.pi/180 for x in range(int(begin), int(end) + 1)]
        self.sc.axes.plot(theta2, [(1 + 1/25) for i in theta2], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta2[:1], ([(1 + 1/25) for i in theta2])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta2[len(theta2)-2:len(theta2)-1], ([(1 + 1/25) for i in theta2])[:1], 'bX', label=f'угол конца канавки {end}°')

    else:
      begin = 360
      end = 0
    
    # if "ugw" in name:
    #    for i in range(len(schedule_forces)):
    #       if (schedule_forces[i] == max(schedule_forces)):
    #          self.sc.axes.plot([theta[i]], [radius1], 'gX', label=f'максимальное давление пленки {max(schedule_forces)}\nугол {angle_difference[i]}°')

    # else:
    #   flag = 1
    #   vals_270_90 = []
    #   vals_90_270 = []
    #   for x in angle_difference:
    #     val = x
    #     if int(x)<0:
    #       x = str(int(x)+360)
    #     if 0<=int(x)<90 or 270<int(x)<450:
    #       vals_270_90.append(schedule_forces[list(angle_difference).index(val)])
    #     else:
    #       vals_90_270.append(schedule_forces[list(angle_difference).index(val)])

    #   for i in range(len(schedule_forces)):
    #       if (len(vals_270_90) and schedule_forces[i] == max(vals_270_90)):
    #          self.sc.axes.plot([theta[i]], [max(vals_270_90)], 'gX', label=f'максимальное давление плёнки в верхнем вкладыше\nдавление: {max(vals_270_90)}\nугол: {angle_difference[i]}°')
    #       elif (len(vals_90_270) and schedule_forces[i] == max(vals_90_270)):
    #          self.sc.axes.plot([theta[i]], [max(vals_90_270)], 'yX', label=f'максимальное давление плёнки в нижнем вкладыше\nдавление: {max(vals_90_270)}\nугол: {angle_difference[i]}°')
      
    # self.sc.axes.plot(theta1, [radius1 for i in theta1], 'g', label='граница')
    
    # self.sc.axes.set_rgrids(np.arange(0,20000, 5000))
             
    # self.sc.axes.set_rgrids(np.arange(0, radius1, radius1/5))
    # "{:.2f}".format(round(radius1/5, 2))
    self.sc.axes.grid(True)
    if 'Bearing' in name:
      self.sc.axes.set_theta_direction(-1)
      self.sc.axes.set_theta_offset(+0.5*np.pi)

    # if not flag:
    self.sc.axes.legend(bbox_to_anchor=(1, 0.6))
    # else:
    #   self.sc.axes.legend(bbox_to_anchor=(1, 1))

    # self.sc.axes.plot(0, 0, 'k+')
    self.sc.axes.set_title(name)

  def polar_graphic_dm(self, schedule_forces: list, angle_difference, name: str, number):

    flag = 0

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    patch_theta = list()
    patch_vals = list()

    patch_theta.append(theta_first_sector[-1])
    patch_theta.append(theta_second_sector[0])
    patch_vals.append(fval_first_sector[-1])
    patch_vals.append(fval_second_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'k')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_second_sector[-1])
    patch_theta.append(theta_third_sector[0])
    patch_vals.append(fval_second_sector[-1])
    patch_vals.append(fval_third_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'r')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_third_sector[-1])
    patch_theta.append(theta_fourth_sector[0])
    patch_vals.append(fval_third_sector[-1])
    patch_vals.append(fval_fourth_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'g')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_fourth_sector[-1])
    patch_theta.append(theta_first_sector[0])
    patch_vals.append(fval_fourth_sector[-1])
    patch_vals.append(fval_first_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'b')

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    self.sc.axes.plot(theta1, [radius1 + radius1/25 for i in theta1], 'c', zorder=2)
    self.sc.axes.spines['polar'].set_visible(False)
    print(self.expert.excel)
    # if number!=0 or 'ugm' in name:

    if number!=0 and 'ugm' in name:
      begin = self.data.excel[f'MN{number}01']
      end = self.data.excel[f'MN{number}02']

      if int(begin) < 0:
        begin = int(begin) + 360
      elif int(end) < 0:
        end = int(end) + 360

      if int(begin) > int(end):
        theta_end = [x*np.pi/180 for x in range(int(end)+1)]
        theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
        self.sc.axes.plot(theta_end, [(radius1 + 2*radius1/25) for i in theta_end], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta_begin, [(radius1 + 2*radius1/25) for i in theta_begin], color='#ffff99', linewidth=6, zorder=1,)
        self.sc.axes.plot(theta_begin[:1], ([(radius1 + 2*radius1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(radius1 + 2*radius1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
      
      elif int(begin) < int(end):
        theta2 = [x*np.pi/180 for x in range(int(begin), int(end) + 1)]
        self.sc.axes.plot(theta2, [(radius1 + 2*radius1/25) for i in theta2], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta2[:1], ([(radius1 + 2*radius1/25) for i in theta2])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta2[len(theta2)-2:len(theta2)-1], ([(radius1 + 2*radius1/25) for i in theta2])[:1], 'bX', label=f'угол конца канавки {end}°')

    else:
      begin = 360
      end = 0
    
    if "ugw" in name:
      self.sc.axes.set_title('PRESSURE DIAGRAM - Shaft angle')
      for i in range(len(schedule_forces)):
        if (schedule_forces[i] == max(schedule_forces)):
          self.sc.axes.plot([theta[i]], [(radius1 + 2*radius1/25)], 'gX', label=f'максимальное давление пленки {"{:.1f}".format(round(max(schedule_forces), 1))}\nугол: {round(angle_difference[i])}°')

    else:
      self.sc.axes.set_title('PRESSURE DIAGRAM - Bearing angle')
      flag = 1
      vals_270_90 = []
      vals_90_270 = []
      for x in angle_difference:
        if 0<=int(x)<90 or 270<int(x)<450:
          vals_270_90.append(schedule_forces[angle_difference.index(x)])
        else:
          vals_90_270.append(schedule_forces[angle_difference.index(x)])

      for i in range(len(schedule_forces)):
          if (len(vals_270_90) and schedule_forces[i] == max(vals_270_90)):
             self.sc.axes.plot([theta[i]], [(radius1 + 2*radius1/25)], 'gX', label=f'максимальное давление плёнки в верхнем вкладыше\nдавление: {"{:.1f}".format(round(max(vals_270_90), 1))}\nугол: {round(angle_difference[i])}°')
          elif (len(vals_90_270) and schedule_forces[i] == max(vals_90_270)):
             self.sc.axes.plot([theta[i]], [(radius1 + 2*radius1/25)], 'kX', label=f'максимальное давление плёнки в нижнем вкладыше\nдавление: {"{:.1f}".format(round(max(vals_90_270), 1))}\nугол: {round(angle_difference[i])}°')
             
       
    # self.sc.axes.bar(theta_first_sector, fval_first_sector, radius1+1)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)

    self.sc.axes.set_rgrids(np.arange(0, radius1, radius1/5))
    self.sc.axes.set_theta_direction(-1)
    self.sc.axes.grid(False)
    self.sc.axes.plot(0, 0, 'k+')
    self.sc.axes.set_theta_offset(+0.5*np.pi)

    if not flag:
      self.sc.axes.legend(bbox_to_anchor=(1, 0.6))
    else:
      self.sc.axes.legend(bbox_to_anchor=(1, 1))

  def polar_graphic_dm_save(self, schedule_forces: list, angle_difference, name: str, number):

    ax = plt.subplot(projection='polar')

    flag = 0

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    ax.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    ax.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    ax.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    ax.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    if number!=0:
      begin = self.data.excel[f'MN{number}01']
      end = self.data.excel[f'MN{number}02']

      if int(begin) < 0:
        begin = int(begin) + 360
      elif int(end) < 0:
        end = int(end) + 360

      if int(begin) > int(end):
        theta_end = [x*np.pi/180 for x in range(int(end)+1)]
        theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
        self.sc.axes.plot(theta_end, [(radius1 + 2*radius1/25) for i in theta_end], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta_begin, [(radius1 + 2*radius1/25) for i in theta_begin], color='#ffff99', linewidth=6, zorder=1,)
        self.sc.axes.plot(theta_begin[:1], ([(radius1 + radius1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(radius1 + radius1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
      
      elif int(begin) < int(end):
        theta2 = [x*np.pi/180 for x in range(int(begin), int(end) + 1)]
        self.sc.axes.plot(theta2, [(radius1 + 2*radius1/25) for i in theta2], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta2[:1], ([(radius1 + radius1/25) for i in theta2])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta2[len(theta2)-2:len(theta2)-1], ([(radius1 + radius1/25) for i in theta2])[:1], 'bX', label=f'угол конца канавки {end}°')

    else:
      begin = 360
      end = 0
    
    if "ugw" in name:
       for i in range(len(schedule_forces)):
          if (schedule_forces[i] == max(schedule_forces)):
             ax.plot([theta[i]], [radius1], 'gX', label=f'максимальное давление пленки {max(schedule_forces)}\nугол {angle_difference[i]}°')

    else:
      flag = 1
      vals_270_90 = []
      vals_90_270 = []
      for x in angle_difference:
        if 0<=int(x)<90 or 270<int(x)<450:
          vals_270_90.append(schedule_forces[angle_difference.index(x)])
        else:
          vals_90_270.append(schedule_forces[angle_difference.index(x)])

      for i in range(len(schedule_forces)):
          if (schedule_forces[i] == max(vals_270_90)):
             ax.plot([theta[i]], [max(vals_270_90)], 'gX', label=f'максимальное давление плёнки в верхнем вкладыше\nдавление: {max(schedule_forces)}\nугол: {angle_difference[i]}°')
          elif (schedule_forces[i] == max(vals_90_270)):
             ax.plot([theta[i]], [max(vals_90_270)], 'yX', label=f'максимальное давление плёнки в нижнем вкладыше\nдавление: {max(schedule_forces)}\nугол: {angle_difference[i]}°')
             
       
    # self.sc.axes.bar(theta_first_sector, fval_first_sector, radius1+1)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)

    ax.set_rgrids(np.arange(0, radius1, radius1/5))
    ax.set_theta_direction(-1)
    ax.set_theta_offset(+0.5*np.pi)

    if not flag:
      plt.legend(bbox_to_anchor=(1, 0.6))
    else:
      plt.legend(bbox_to_anchor=(1, 1))

    plt.title(name)

  def polar_graphic_hmin(self, schedule_forces: list, angle_difference, name: str, number):

    flag = 0

    radius1 = max(schedule_forces)
    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    patch_theta = list()
    patch_vals = list()

    patch_theta.append(theta_first_sector[-1])
    patch_theta.append(theta_second_sector[0])
    patch_vals.append(fval_first_sector[-1])
    patch_vals.append(fval_second_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'k')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_second_sector[-1])
    patch_theta.append(theta_third_sector[0])
    patch_vals.append(fval_second_sector[-1])
    patch_vals.append(fval_third_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'r')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_third_sector[-1])
    patch_theta.append(theta_fourth_sector[0])
    patch_vals.append(fval_third_sector[-1])
    patch_vals.append(fval_fourth_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'g')

    patch_theta.clear()
    patch_vals.clear()

    patch_theta.append(theta_fourth_sector[-1])
    patch_theta.append(theta_first_sector[0])
    patch_vals.append(fval_fourth_sector[-1])
    patch_vals.append(fval_first_sector[0])

    self.sc.axes.plot(patch_theta, patch_vals, 'b')

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    self.sc.axes.plot(theta1, [radius1+radius1/25 for i in theta1], 'c', zorder=2)
    self.sc.axes.spines['polar'].set_visible(False)
    if number!=0:
      begin = self.data.excel[f'MN{number}01']
      end = self.data.excel[f'MN{number}02']

      if int(begin) < 0:
        begin = int(begin) + 360
      elif int(end) < 0:
        end = int(end) + 360

      if int(begin) > int(end):
        theta_end = [x*np.pi/180 for x in range(int(end)+1)]
        theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
        self.sc.axes.plot(theta_end, [(radius1 + 2*radius1/25) for i in theta_end], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta_begin, [(radius1 + 2*radius1/25) for i in theta_begin], color='#ffff99', linewidth=6, zorder=1,)
        self.sc.axes.plot(theta_begin[:1], ([(radius1 + radius1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(radius1 + radius1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
      
      elif int(begin) < int(end):
        theta2 = [x*np.pi/180 for x in range(int(begin), int(end) + 1)]
        self.sc.axes.plot(theta2, [(radius1 + 2*radius1/25) for i in theta2], color='#ffff99', linewidth=6, zorder=1, label='канавка')
        self.sc.axes.plot(theta2[:1], ([(radius1 + radius1/25) for i in theta2])[:1], 'rX', label=f'угол начала канавки {begin}°')
        self.sc.axes.plot(theta2[len(theta2)-2:len(theta2)-1], ([(radius1 + radius1/25) for i in theta2])[:1], 'bX', label=f'угол конца канавки {end}°')

    else:
      begin = 360
      end = 0
    
    if "GAM" in name:
       for i in range(len(schedule_forces)):
          if (schedule_forces[i] == min(schedule_forces)):
             self.sc.axes.plot([theta[i]], [(radius1 + radius1/25)], 'gX', label=f'минимальная толщина плёнки {"{:.1f}".format(round(min(schedule_forces)*1000, 3))} micron\nугол: {round(angle_difference[i])}°')
    else:
      flag = 1
      vals_270_90 = []
      vals_90_270 = []
      for x in angle_difference:
        if 0<=int(x)<90 or 270<int(x)<450:
          vals_270_90.append(schedule_forces[angle_difference.index(x)])
        else:
          vals_90_270.append(schedule_forces[angle_difference.index(x)])

      for i in range(len(schedule_forces)):
          if (len(vals_270_90) and schedule_forces[i] == min(vals_270_90)):
             self.sc.axes.plot([theta[i]], [(radius1 + radius1/25)], 'gX', label=f'минимальная толщина плёнки в верхнем вкладыше\nтолщина: {"{:.1f}".format(round(min(vals_270_90)*1000, 3))} micron\nугол: {round(angle_difference[i])}°')
          elif (len(vals_90_270) and schedule_forces[i] == min(vals_90_270)):
             self.sc.axes.plot([theta[i]], [(radius1 + radius1/25)], 'kX', label=f'минимальная толщина плёнки в нижнем вкладыше\nтолщина: {"{:.1f}".format(round(min(vals_90_270)*1000, 3))} micron\nугол: {round(angle_difference[i])}°')
             
       
    # self.sc.axes.bar(theta_first_sector, fval_first_sector, radius1+1)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)
    # self.sc.axes.set_rgrids(np.arange(0, radius1, radius1/5))
    self.sc.axes.set_theta_direction(-1)
    self.sc.axes.grid(True)
    self.sc.axes.set_theta_offset(+0.5*np.pi)

    if not flag:
      self.sc.axes.legend(bbox_to_anchor=(1, 0.6))
    else:
      self.sc.axes.legend(bbox_to_anchor=(1, 1))

    self.sc.axes.set_title(name)

  def yg_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg(), self.excel.yg())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle", 0, "ssch")

  def yg_shaft_graphic(self):
    rho, phi = cart2pol(self.excel.xq(), self.excel.yq())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle", 0, "ssch")

  def yg1_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg1(), self.excel.yg1())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")

  def yg1_shaft_graphic(self):
    rho, phi = cart2pol(self.excel.xq1(), self.excel.yq1())
    # print(phi)
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

  def yg2_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg2(), self.excel.yg2())
    print('yg2_bearing')
    print(phi)
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")
  
  def yg2_shaft_graphic(self):
    rho, phi = cart2pol(self.excel.xq2(), self.excel.yq2())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

  def yg3_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg3(), self.excel.yg3())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")

  def yg3_shaft_graphic(self):
    rho, phi = cart2pol(self.excel.xq3(), self.excel.yq3())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

  def yg4_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg4(), self.excel.yg4())
    self.polar_graphic_orbit(rho, phi,"CENTER LOCUS (ORBIT) - Bearing angle")

  def yg4_shaft_graphic(self): 
    rho, phi = cart2pol(self.excel.xq4(), self.excel.yq4())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

### BEGIN
  
  def yg5_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg5(), self.excel.yg5())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")

  def yg5_shaft_graphic(self): 
    rho, phi = cart2pol(self.excel.xq5(), self.excel.yq5())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

  def yg6_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg6(), self.excel.yg6())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")

  def yg6_shaft_graphic(self): 
    rho, phi = cart2pol(self.excel.xq6(), self.excel.yq6())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

  def yg7_bearing_graphic(self):
    rho, phi = cart2pol(self.excel.xg7(), self.excel.yg7())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Bearing angle")

  def yg7_shaft_graphic(self): 
    rho, phi = cart2pol(self.excel.xq7(), self.excel.yq7())
    self.polar_graphic_orbit(rho, phi, "CENTER LOCUS (ORBIT) - Shaft angle")

### END
  
  # def yg_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg(), self.excel.yg(), "yg-неподвижный подшипник")

  # def yg_shaft_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xq(), self.excel.yq(), "yg-неподвижный вал")

  # def yg1_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg1(), self.excel.yg1(), "yg1-неподвижный подшипник")

  # def yg1_shaft_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xq1(), self.excel.yq1(), "yg1 - неподвижный вал")

  # def yg2_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg2(), self.excel.yg2(), "yg2-неподвижный подшипник")
  
  # def yg2_shaft_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xq2(), self.excel.yq2(), "yg2 - неподвижный вал")

  # def yg3_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg3(), self.excel.yg3(), "yg3-неподвижный подшипник")

  # def yg3_shaft_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xq3(), self.excel.yq3(), "yg3 - неподвижный вал")

  # def yg4_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg4(), self.excel.yg4(), "yg4-неподвижный подшипник")

  # def yg4_shaft_graphic_for_save(self): 
  #   self.cartesian_graphic_for_save(self.excel.xq4(), self.excel.yq4(), "yg4 - неподвижный вал")
  
  # def yg5_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg5(), self.excel.yg5(), "yg5-неподвижный подшипник")

  # def yg5_shaft_graphic_for_save(self): 
  #   self.cartesian_graphic_for_save(self.excel.xq5(), self.excel.yq5(), "yg5 - неподвижный вал")

  # def yg6_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg6(), self.excel.yg6(), "yg6-неподвижный подшипник")

  # def yg6_shaft_graphic_for_save(self): 
  #   self.cartesian_graphic_for_save(self.excel.xq6(), self.excel.yq6(), "yg6 - неподвижный вал")

  # def yg7_bearing_graphic_for_save(self):
  #   self.cartesian_graphic_for_save(self.excel.xg7(), self.excel.yg7(), "yg7-неподвижный подшипник")

  # def yg7_shaft_graphic_for_save(self): 
  #   self.cartesian_graphic_for_save(self.excel.xq7(), self.excel.yq7(), "yg7 - неподвижный вал")

  def FSUM_BETA_graphic(self):
    self.polar_graphic(self.excel.getFSUM(), self.excel.getBETA(), 'FSUM - BETA')

  def FSUM_GAM_graphic(self):
    self.polar_graphic(self.excel.getFSUM(), self.excel.getGAM(), "FSUM - GAM")     
 
  def FSUM1_BETA1_graphic(self):
    self.polar_graphic(self.excel.getFSUM1(), self.excel.getBETA1(), "FSUM1 - BETA1")

  def FSUM2_BETA2_graphic(self):
    self.polar_graphic(self.excel.getFSUM2(), self.excel.getBETA2(), "FSUM2 - BETA2")

  def FSUM3_BETA3_graphic(self):
    self.polar_graphic(self.excel.getFSUM3(), self.excel.getBETA3(), "FSUM3 - BETA3")

  def FSUM4_BETA4_graphic(self):
    self.polar_graphic(self.excel.getFSUM4(), self.excel.getBETA4(), "FSUM4 - BETA4")

  def FSUM5_BETA5_graphic(self):
    self.polar_graphic(self.excel.getFSUM5(), self.excel.getBETA5(), "FSUM5 - BETA5")

  def FSUM6_BETA6_graphic(self):
    self.polar_graphic(self.excel.getFSUM6(), self.excel.getBETA6(), "FSUM6 - BETA6")

  def FSUM7_BETA7_graphic(self):
    self.polar_graphic(self.excel.getFSUM7(), self.excel.getBETA7(), "FSUM7 - BETA7")     
 
  def FSUM1_GAM1_graphic(self):
    self.polar_graphic(self.excel.getFSUM1(), self.excel.getGAM1(), "FSUM1 - GAM1")

  def FSUM2_GAM2_graphic(self):
    self.polar_graphic(self.excel.getFSUM2(), self.excel.getGAM2(), "FSUM2 - GAM2")

  def FSUM3_GAM3_graphic(self):
    self.polar_graphic(self.excel.getFSUM3(), self.excel.getGAM3(), "FSUM3 - GAM3")

  def FSUM4_GAM4_graphic(self):
    self.polar_graphic(self.excel.getFSUM4(), self.excel.getGAM4(), "FSUM4 - GAM4") 

  def FSUM5_GAM5_graphic(self):
    self.polar_graphic(self.excel.getFSUM5(), self.excel.getGAM5(), "FSUM5 - GAM5")   

  def FSUM6_GAM6_graphic(self):
    self.polar_graphic(self.excel.getFSUM6(), self.excel.getGAM6(), "FSUM6 - GAM6")   

  def FSUM7_GAM7_graphic(self):
    self.polar_graphic(self.excel.getFSUM7(), self.excel.getGAM7(), "FSUM7 - GAM7")

  def PSUM_BETA_graphic(self):
    self.polar_graphic(self.excel.PSUM(), self.excel.getBETA(), 'POLAR LOAD DIAGRAM')

  def PSUM_GAM_graphic(self):
    self.polar_graphic(self.excel.PSUM(), self.excel.getGAM(), "POLAR LOAD DIAGRAM")     
 
  def PSUM1_BETA1_graphic(self):
    self.polar_graphic(self.excel.PSUM1(), self.excel.getBETA1(), "POLAR LOAD DIAGRAM")

  def PSUM2_BETA2_graphic(self):
    self.polar_graphic(self.excel.PSUM2(), self.excel.getBETA2(), "POLAR LOAD DIAGRAM")

  def PSUM3_BETA3_graphic(self):
    self.polar_graphic(self.excel.PSUM3(), self.excel.getBETA3(), "POLAR LOAD DIAGRAM")

  def PSUM4_BETA4_graphic(self):
    self.polar_graphic(self.excel.PSUM4(), self.excel.getBETA4(), "POLAR LOAD DIAGRAM")

  def PSUM5_BETA5_graphic(self):
    self.polar_graphic(self.excel.PSUM5(), self.excel.getBETA5(), "POLAR LOAD DIAGRAM")

  def PSUM6_BETA6_graphic(self):
    self.polar_graphic(self.excel.PSUM6(), self.excel.getBETA6(), "POLAR LOAD DIAGRAM")

  def PSUM7_BETA7_graphic(self):
    self.polar_graphic(self.excel.PSUM7(), self.excel.getBETA7(), "POLAR LOAD DIAGRAM")     
 
  def PSUM1_GAM1_graphic(self):
    self.polar_graphic(self.excel.PSUM1(), self.excel.getGAM1(), "POLAR LOAD DIAGRAM")

  def PSUM2_GAM2_graphic(self):
    self.polar_graphic(self.excel.PSUM2(), self.excel.getGAM2(), "POLAR LOAD DIAGRAM")

  def PSUM3_GAM3_graphic(self):
    self.polar_graphic(self.excel.PSUM3(), self.excel.getGAM3(), "POLAR LOAD DIAGRAM")

  def PSUM4_GAM4_graphic(self):
    self.polar_graphic(self.excel.PSUM4(), self.excel.getGAM4(), "POLAR LOAD DIAGRAM") 

  def PSUM5_GAM5_graphic(self):
    self.polar_graphic(self.excel.PSUM5(), self.excel.getGAM5(), "POLAR LOAD DIAGRAM")   

  def PSUM6_GAM6_graphic(self):
    self.polar_graphic(self.excel.PSUM6(), self.excel.getGAM6(), "POLAR LOAD DIAGRAM")   

  def PSUM7_GAM7_graphic(self):
    self.polar_graphic(self.excel.PSUM7(), self.excel.getGAM7(), "POLAR LOAD DIAGRAM")

  def hmin_BETA(self):
     self.polar_graphic_hmin(self.excel.hmin(), self.excel.getBETA(), "hmin - BETA", 0)
     
  def hmin1_BETA1(self):
     self.polar_graphic_hmin(self.excel.hmin1(), self.excel.getBETA1(), "hmin1 - BETA1", 1)

  def hmin2_BETA2(self):
     self.polar_graphic_hmin(self.excel.hmin2(), self.excel.getBETA2(), "hmin2 - BETA2", 2)

  def hmin3_BETA3(self):
     self.polar_graphic_hmin(self.excel.hmin3(), self.excel.getBETA3(), "hmin3 - BETA3", 3)

  def hmin4_BETA4(self):
     self.polar_graphic_hmin(self.excel.hmin4(), self.excel.getBETA4(), "hmin4 - BETA4", 4)

  def hmin5_BETA5(self):
     self.polar_graphic_hmin(self.excel.hmin5(), self.excel.getBETA5(), "hmin5 - BETA5", 5)

  def hmin6_BETA6(self):
     self.polar_graphic_hmin(self.excel.hmin6(), self.excel.getBETA6(), "hmin6 - BETA6", 6)

  def hmin7_BETA7(self):
     self.polar_graphic_hmin(self.excel.hmin7(), self.excel.getBETA7(), "hmin7 - BETA7", 7)

  def hmin_GAM(self):
     self.polar_graphic_hmin(self.excel.hmin(), self.excel.getGAM(), "hmin - GAM", 0)

  def hmin1_GAM1(self):
     self.polar_graphic_hmin(self.excel.hmin1(), self.excel.getGAM1(), "hmin1 - GAM1", 1)
    
  def hmin2_GAM2(self):
     self.polar_graphic_hmin(self.excel.hmin2(), self.excel.getGAM2(), "hmin2 - GAM2", 2)

  def hmin3_GAM3(self):
     self.polar_graphic_hmin(self.excel.hmin3(), self.excel.getGAM3(), "hmin3 - GAM3", 3)
  
  def hmin4_GAM4(self):
     self.polar_graphic_hmin(self.excel.hmin4(), self.excel.getGAM4(), "hmin4 - GAM4", 4)

  def hmin5_GAM5(self):
     self.polar_graphic_hmin(self.excel.hmin5(), self.excel.getGAM5(), "hmin5 - GAM5", 5)

  def hmin6_GAM6(self):
     self.polar_graphic_hmin(self.excel.hmin6(), self.excel.getGAM6(), "hmin6 - GAM6", 6)
  
  def hmin7_GAM7(self):
     self.polar_graphic_hmin(self.excel.hmin7(), self.excel.getGAM7(), "hmin7 - GAM7", 7)

  def dm_ugm(self):
     self.polar_graphic_dm(self.excel.dm(), self.excel.ugm(), "dm_ugm", 0)

  def dm1_ugm1(self):
     self.polar_graphic_dm(self.excel.dm1(), self.excel.ugm1(), "dm1_ugm1", 1)

  def dm2_ugm2(self):
     self.polar_graphic_dm(self.excel.dm2(), self.excel.ugm2(), "dm2_ugm2", 2)
  
  def dm3_ugm3(self):
     self.polar_graphic_dm(self.excel.dm3(), self.excel.ugm3(), "dm3_ugm3", 3)

  def dm4_ugm4(self):
     self.polar_graphic_dm(self.excel.dm4(), self.excel.ugm4(), "dm4_ugm4", 4)

  def dm5_ugm5(self):
     self.polar_graphic_dm(self.excel.dm5(), self.excel.ugm5(), "dm5_ugm5", 5)

  def dm6_ugm6(self):
     self.polar_graphic_dm(self.excel.dm6(), self.excel.ugm6(), "dm6_ugm6", 6)

  def dm7_ugm7(self):
     self.polar_graphic_dm(self.excel.dm7(), self.excel.ugm7(), "dm7_ugm7", 7)

  def dm_ugw(self):
     self.polar_graphic_dm(self.excel.dm(), self.excel.ugw(), "dm_ugw", 0)

  def dm1_ugw1(self):
     self.polar_graphic_dm(self.excel.dm1(), self.excel.ugw1(), "dm1_ugw1", 1)

  def dm2_ugw2(self):
     self.polar_graphic_dm(self.excel.dm2(), self.excel.ugw2(), "dm2_ugw2", 2)

  def dm3_ugw3(self):
     self.polar_graphic_dm(self.excel.dm3(), self.excel.ugw3(), "dm3_ugw3", 3)

  def dm4_ugw4(self):
     self.polar_graphic_dm(self.excel.dm4(), self.excel.ugw4(), "dm4_ugw4", 4)

  def dm5_ugw5(self):
     self.polar_graphic_dm(self.excel.dm5(), self.excel.ugw5(), "dm5_ugw5", 5)

  def dm6_ugw6(self):
     self.polar_graphic_dm(self.excel.dm6(), self.excel.ugw6(), "dm6_ugw6", 6)
    
  def dm7_ugw7(self):
     self.polar_graphic_dm(self.excel.dm7(), self.excel.ugw7(), "dm7_ugw7", 7)

  def dm_ugm_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm(), self.excel.ugm(), "dm - ugm", 0)

  def dm1_ugm1_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm1(), self.excel.ugm1(), "dm1 - ugm1", 1)

  def dm2_ugm2_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm2(), self.excel.ugm2(), "dm2 - ugm2", 2)
  
  def dm3_ugm3_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm3(), self.excel.ugm3(), "dm3 - ugm3", 3)

  def dm4_ugm4_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm4(), self.excel.ugm4(), "dm4 - ugm4", 4)

  def dm5_ugm5_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm5(), self.excel.ugm5(), "dm5 - ugm5", 5)

  def dm6_ugm6_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm6(), self.excel.ugm6(), "dm6 - ugm6", 6)

  def dm7_ugm7_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm7(), self.excel.ugm7(), "dm7 - ugm7", 7)

  def dm_ugw_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm(), self.excel.ugw(), "dm - ugw", 0)

  def dm1_ugw1_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm1(), self.excel.ugw1(), "dm1 - ugw1", 1)

  def dm2_ugw2_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm2(), self.excel.ugw2(), "dm2 - ugw2", 2)

  def dm3_ugw3_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm3(), self.excel.ugw3(), "dm3 - ugw3", 3)

  def dm4_ugw4_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm4(), self.excel.ugw4(), "dm4 - ugw4", 4)

  def dm5_ugw5_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm5(), self.excel.ugw5(), "dm5 - ugw5", 5)

  def dm6_ugw6_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm6(), self.excel.ugw6(), "dm6 - ugw6", 6)
    
  def dm7_ugw7_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm7(), self.excel.ugw7(), "dm7 - ugw7", 7)
 
  def hmin_FHMIN(self):
    hmin = []
    for i in range(len(self.excel.hmin())):
      hmin.append((self.excel.hmin())[i] * 1000)
    self.polar_graphic_FHMIN(hmin, self.excel.FHMIN())

  def hmin1_FHMIN1(self):
    hmin1 = []
    for i in range(len(self.excel.hmin1())):
      hmin1.append((self.excel.hmin1())[i] * 1000)
    self.polar_graphic_FHMIN(hmin1, self.excel.FHMIN1())

  def hmin2_FHMIN2(self):
    hmin2 = []
    for i in range(len(self.excel.hmin2())):
      hmin2.append((self.excel.hmin2())[i] * 1000)
    self.polar_graphic_FHMIN(hmin2, self.excel.FHMIN2())

  def hmin3_FHMIN3(self):
    hmin3 = []
    for i in range(len(self.excel.hmin3())):
      hmin3.append((self.excel.hmin3())[i] * 1000)
    self.polar_graphic_FHMIN(hmin3, self.excel.FHMIN3())

  def hmin4_FHMIN4(self):
    hmin4 = []
    for i in range(len(self.excel.hmin4())):
      hmin4.append((self.excel.hmin4())[i] * 1000)
    self.polar_graphic_FHMIN(hmin4, self.excel.FHMIN4())

  def hmin5_FHMIN5(self):
    hmin5 = []
    for i in range(len(self.excel.hmin5())):
      hmin5.append((self.excel.hmin5())[i] * 1000)
    self.polar_graphic_FHMIN(hmin5, self.excel.FHMIN5())

  def hmin6_FHMIN6(self):
    hmin6 = []
    for i in range(len(self.excel.hmin6())):
      hmin6.append((self.excel.hmin6())[i] * 1000)
    self.polar_graphic_FHMIN(hmin6, self.excel.FHMIN6())

  def hmin7_FHMIN7(self):
    hmin7 = []
    for i in range(len(self.excel.hmin7())):
      hmin7.append((self.excel.hmin7())[i] * 1000)
    self.polar_graphic_FHMIN(hmin7, self.excel.FHMIN7())
  
class Graphics_children(QtWidgets.QWidget):
  def __init__(self, path):
    super().__init__()

    self.expert = Expert()

    self.sc = MplCanvas(self, width=5, height=4, dpi=100)
    # self.scp = MplPolarCanvas(self, width=5, height=4, dpi=100)
    self.excel = ReadExcel(path)

    toolbar = NavigationToolbar(self.sc, self)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(toolbar)
    layout.addWidget(self.sc)
    self.method = 0
    self.setLayout(layout)

  def remember_method(self, called_method):
    self.method = called_method

  def PIND_graphic(self):
    Graphics.PIND_graphic(self, self.phase_shift_0)

  def FSUM_graphic(self):
     Graphics.FSUM_graphic(self, self.phase_shift_0)
    
  def beta_graphic(self):
     Graphics.beta_graphic(self, self.phase_shift_0)

  def GAM_graphic(self):
     Graphics.GAM_graphic(self, self.phase_shift_0)
  
  def FSUM1_graphic(self):
     Graphics.FSUM1_graphic(self, self.phase_shift_0)
    
  def BETA1_graphic(self):
     Graphics.BETA1_graphic(self, self.phase_shift_0)

  def GAM1_graphic(self):
     Graphics.GAM1_graphic(self, self.phase_shift_0)
  
  def FSUM2_graphic(self):
     Graphics.FSUM2_graphic(self, self.phase_shift_0)
    
  def BETA2_graphic(self):
     Graphics.BETA2_graphic(self, self.phase_shift_0)

  def GAM2_graphic(self):
     Graphics.GAM2_graphic(self, self.phase_shift_0)

  def FSUM3_graphic(self):
     Graphics.FSUM3_graphic(self, self.phase_shift_0)
    
  def BETA3_graphic(self):
     Graphics.BETA3_graphic(self, self.phase_shift_0)

  def GAM3_graphic(self):
     Graphics.GAM3_graphic(self, self.phase_shift_0)

  def FSUM4_graphic(self):
     Graphics.FSUM4_graphic(self, self.phase_shift_0)
    
  def BETA4_graphic(self):
     Graphics.BETA4_graphic(self, self.phase_shift_0)

  def GAM4_graphic(self):
     Graphics.GAM4_graphic(self, self.phase_shift_0)

  def FSUM5_graphic(self):
     Graphics.FSUM5_graphic(self, self.phase_shift_0)
    
  def BETA5_graphic(self):
     Graphics.BETA5_graphic(self, self.phase_shift_0)

  def GAM5_graphic(self):
     Graphics.GAM5_graphic(self, self.phase_shift_0)

  def FSUM6_graphic(self):
     Graphics.FSUM6_graphic(self, self.phase_shift_0)
    
  def BETA6_graphic(self):
     Graphics.BETA6_graphic(self, self.phase_shift_0)

  def GAM6_graphic(self):
     Graphics.GAM6_graphic(self, self.phase_shift_0)

  def FSUM7_graphic(self):
     Graphics.FSUM7_graphic(self, self.phase_shift_0)
    
  def BETA7_graphic(self):
     Graphics.BETA7_graphic(self, self.phase_shift_0)

  def GAM7_graphic(self):
     Graphics.GAM7_graphic(self, self.phase_shift_0)

  def PSUM_graphic(self):
     Graphics.PSUM_graphic(self, self.phase_shift_0)

  def PSUM1_graphic(self):
     Graphics.PSUM1_graphic(self, self.phase_shift_0)
  
  def PSUM2_graphic(self):
     Graphics.PSUM2_graphic(self, self.phase_shift_0)

  def PSUM3_graphic(self):
     Graphics.PSUM3_graphic(self, self.phase_shift_0)

  def PSUM4_graphic(self):
     Graphics.PSUM4_graphic(self, self.phase_shift_0)

  def PSUM5_graphic(self):
     Graphics.PSUM5_graphic(self, self.phase_shift_0)

  def PSUM6_graphic(self):
     Graphics.PSUM6_graphic(self, self.phase_shift_0)

  def PSUM7_graphic(self):
     Graphics.PSUM7_graphic(self, self.phase_shift_0)

  def hmin_graphic(self):
     Graphics.hmin_graphic(self, self.phase_shift_0)

  def hmin1_graphic(self):
     Graphics.hmin1_graphic(self, self.phase_shift_0)

  def hmin2_graphic(self):
     Graphics.hmin2_graphic(self, self.phase_shift_0)

  def hmin3_graphic(self):
     Graphics.hmin3_graphic(self, self.phase_shift_0)

  def hmin4_graphic(self):
     Graphics.hmin4_graphic(self, self.phase_shift_0)

  def hmin5_graphic(self):
     Graphics.hmin5_graphic(self, self.phase_shift_0)

  def hmin6_graphic(self):
     Graphics.hmin6_graphic(self, self.phase_shift_0)

  def hmin7_graphic(self):
     Graphics.hmin7_graphic(self, self.phase_shift_0)

  def ugm_graphic(self):
     Graphics.ugm_graphic(self, self.phase_shift_0)

  def ugm1_graphic(self):
     Graphics.ugm1_graphic(self, self.phase_shift_0)

  def ugm2_graphic(self):
     Graphics.ugm2_graphic(self, self.phase_shift_0)

  def ugm3_graphic(self):
     Graphics.ugm3_graphic(self, self.phase_shift_0)

  def ugm4_graphic(self):
     Graphics.ugm4_graphic(self, self.phase_shift_0)

  def ugm5_graphic(self):
     Graphics.ugm5_graphic(self, self.phase_shift_0)

  def ugm6_graphic(self):
     Graphics.ugm6_graphic(self, self.phase_shift_0)

  def ugm7_graphic(self):
     Graphics.ugm7_graphic(self, self.phase_shift_0)

  def ugw_graphic(self):
     Graphics.ugw_graphic(self, self.phase_shift_0)

  def ugw1_graphic(self):
    Graphics.ugw1_graphic(self, self.phase_shift_0)

  def ugw2_graphic(self):
    Graphics.ugw2_graphic(self, self.phase_shift_0)

  def ugw3_graphic(self):
    Graphics.ugw3_graphic(self, self.phase_shift_0)

  def ugw4_graphic(self):
     Graphics.ugw4_graphic(self, self.phase_shift_0)

  def ugw5_graphic(self):
    Graphics.ugw5_graphic(self, self.phase_shift_0)

  def ugw6_graphic(self):
    Graphics.ugw6_graphic(self, self.phase_shift_0)

  def ugw7_graphic(self):
    Graphics.ugw7_graphic(self, self.phase_shift_0)

  def TN_graphic(self):
     Graphics.TN_graphic(self, self.phase_shift_0)

  def TN1_graphic(self):
     Graphics.TN1_graphic(self, self.phase_shift_0)

  def TN2_graphic(self):
     Graphics.TN2_graphic(self, self.phase_shift_0)
     
  def TN3_graphic(self):
     Graphics.TN3_graphic(self, self.phase_shift_0)

  def TN4_graphic(self):
     Graphics.TN4_graphic(self, self.phase_shift_0)

  def TN5_graphic(self):
     Graphics.TN5_graphic(self, self.phase_shift_0)

  def TN6_graphic(self):
     Graphics.TN6_graphic(self, self.phase_shift_0)

  def TN7_graphic(self):
     Graphics.TN7_graphic(self, self.phase_shift_0)


  def setTicks(self):
    major_xticks = np.arange(0, 721, 180)
    minor_xticks = np.arange(0, 721, 45)
    self.sc.axes.set_xticks(major_xticks)
    self.sc.axes.set_xticks(minor_xticks, minor=True)
    self.sc.axes.grid(which='both')
  
  def phase_shift_360(self, massive2):
  
    print(massive2)

    size = len(massive2) // 2

    y_first_sector = np.empty(size)
    for i in range(size):
      y_first_sector[i] = massive2[i]

    y_second_sector = np.empty(size)
    for i in range(size):
      y_second_sector[i] = massive2[size+i]

    y = np.empty(len(massive2))

    y = np.append(y_second_sector, y_first_sector)
    # y = np.append(y_first_sector)

    print(y)
    return y
  
  def phase_shift_0(self, massive2):
    
    return massive2

class Graphics(QtWidgets.QWidget, object):

  # sc = MplCanvas(width=5, height=4, dpi=100)

  def __init__(self, path, flag):

    super().__init__()

    if not hasattr(Graphics, 'sc'):
       print('Graphics.sc')
       Graphics.sc = MplCanvas(width=5, height=4, dpi=100)

    if not hasattr(Graphics, 'excel'):
       print('Graphics.excel')
       Graphics.excel = ReadExcel(path)

    if flag:
       Graphics.sc = MplCanvas(width=5, height=4, dpi=100)
       Graphics.excel = ReadExcel(path)

    print(Graphics.sc)

    self.expert = Expert()
    self.data = Data()
    # self.scp = MplPolarCanvas(self, width=5, height=4, dpi=100)

    toolbar = NavigationToolbar(Graphics.sc, self)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(toolbar)
    layout.addWidget(Graphics.sc)
    self.method = 0
    self.setLayout(layout)
  
  def remember_method(self, called_method):
     self.method = called_method
     print(f'METHOD: {self.method}')
    
  @classmethod
  def setTicks(cls):
    major_xticks = np.arange(0, 721, 180)
    minor_xticks = np.arange(0, 721, 45)
    cls.sc.axes.set_xticks(major_xticks)
    cls.sc.axes.set_xticks(minor_xticks, minor=True)
    cls.sc.axes.grid(which='both')

  def setTicks_for_ugm(self):
    major_xticks = np.arange(0, 361, 60)
    minor_xticks = np.arange(0, 361, 45)
    self.sc.axes.set_xticks(major_xticks)
    self.sc.axes.set_xticks(minor_xticks, minor=True)
    self.sc.axes.grid(which='both')

  def setTicks_for_ugm_save(self):
    major_xticks = np.arange(0, 361, 60)
    minor_xticks = np.arange(0, 361, 45)
    plt.xticks(major_xticks)
    plt.xticks(minor_xticks, minor=True)
    plt.grid(which='both')

  def setTicks_for_plt(self):
    major_xticks = np.arange(0, 721, 180)
    minor_xticks = np.arange(0, 721, 45)
    plt.xticks(major_xticks)
    plt.xticks(minor_xticks, minor=True)
    plt.grid(which='both')

  def polar_graphic_dm_save(self, schedule_forces: list, angle_difference, name: str, number):

    ax = plt.subplot(projection='polar')

    flag = 0

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    ax.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    ax.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    ax.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    ax.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    if number!=0:
      begin = self.data.excel[f'MN{number}01']
      end = self.data.excel[f'MN{number}02']
      theta_end = [x*np.pi/180 for x in range(int(end)+1)]
      theta_begin = [x*np.pi/180 for x in range(int(begin), 361)]
      ax.plot(theta_end, [(radius1 + radius1/25) for i in theta_end], 'y.', label='канавка')
      ax.plot(theta_begin, [(radius1 + radius1/25) for i in theta_begin], 'y.')
      ax.plot(theta_begin[:1], ([(radius1 + radius1/25) for i in theta_begin])[:1], 'rX', label=f'угол начала канавки {begin}°')
      ax.plot(theta_end[len(theta_end)-2:len(theta_end)-1], ([(radius1 + radius1/25) for i in theta_end])[:1], 'bX', label=f'угол конца канавки {end}°')
    else:
      begin = 360
      end = 0
    
    if "ugw" in name:
       for i in range(len(schedule_forces)):
          if (schedule_forces[i] == max(schedule_forces)):
             ax.plot([theta[i]], [radius1], 'gX', label=f'максимальное давление пленки {max(schedule_forces)}\nугол {angle_difference[i]}°')

    else:
      flag = 1
      vals_270_90 = []
      vals_90_270 = []
      for x in angle_difference:
        if 0<=int(x)<90 or 270<int(x)<450:
          vals_270_90.append(schedule_forces[angle_difference.index(x)])
        else:
          vals_90_270.append(schedule_forces[angle_difference.index(x)])

      for i in range(len(schedule_forces)):
          if (schedule_forces[i] == max(vals_270_90)):
             ax.plot([theta[i]], [max(vals_270_90)], 'gX', label=f'максимальное давление плёнки в верхнем вкладыше\nдавление: {max(schedule_forces)}\nугол: {angle_difference[i]}°')
          elif (schedule_forces[i] == max(vals_90_270)):
             ax.plot([theta[i]], [max(vals_90_270)], 'yX', label=f'максимальное давление плёнки в нижнем вкладыше\nдавление: {max(schedule_forces)}\nугол: {angle_difference[i]}°')
             
       
    # self.sc.axes.bar(theta_first_sector, fval_first_sector, radius1+1)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)
    # self.sc.axes.bar(theta_first_sector, fval_first_sector)

    ax.set_rgrids(np.arange(0, radius1, radius1/5))
    ax.set_theta_direction(-1)
    ax.set_theta_offset(+0.5*np.pi)

    if not flag:
      plt.legend(bbox_to_anchor=(1, 0.6))
    else:
      plt.legend(bbox_to_anchor=(1, 1))

    plt.title(name)

  def draw_polar_graphic(self, schedule_forces: list, angle_difference, i, j, k, name: str):

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    self.sc.axes.plot(theta1, [radius1 for i in theta1], 'g', label='граница')
    
    self.sc.axes.set_rgrids(np.arange(0,20000, 5000))
    self.sc.axes.set_theta_direction(-1)
    self.sc.axes.set_theta_offset(+0.5*np.pi)

    h = 1
    IsLeft = False

    for h in range(i+1):
      if k == h*j:
        plt.legend(bbox_to_anchor=(-0.3, 0.6))
        IsLeft = True
        break

    if (IsLeft == False):
      plt.legend(bbox_to_anchor=(1, 0.6))

    plt.title(name)

  def polar_graphic(self, schedule_forces: list, angle_difference, name: str):
    
    ax = plt.subplot(projection='polar')

    radius1 = max(schedule_forces)

    theta1= np.arange(0, 2*np.pi, 0.01)

    size = len(schedule_forces) // 4
    theta = np.deg2rad(angle_difference)

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = theta[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = theta[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = theta[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = theta[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      fval_first_sector[i] = schedule_forces[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = schedule_forces[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = schedule_forces[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = schedule_forces[3*size+i]

    ax.plot(theta_first_sector, fval_first_sector, 'k', label='0-180')
    ax.plot(theta_second_sector, fval_second_sector, 'r', label='180-360')
    ax.plot(theta_third_sector, fval_third_sector, 'g', label='360-540')
    ax.plot(theta_fourth_sector, fval_fourth_sector, 'b', label='540-720')
    ax.plot(theta1, [radius1 for i in theta1], 'g', label='граница')
    
    ax.set_rgrids(np.arange(0,20000, 5000))
    ax.set_theta_direction(-1)
    ax.set_theta_offset(+0.5*np.pi)

    plt.legend(bbox_to_anchor=(1, 0.6))

    plt.title(name)
      

  def draw_cartesian_graphic(self, massive1, massive2, i, j, k, name):

    ax = plt.subplot(i, j, k)

    line = i
    column = j
    pos = k

    size = len(massive1) // 4

    x_first_sector = np.empty(size)
    for i in range(size):
      x_first_sector[i] = massive1[i]

    x_second_sector = np.empty(size)
    for i in range(size):
      x_second_sector[i] = massive1[size+i]

    x_third_sector = np.empty(size)
    for i in range(size):
      x_third_sector[i] = massive1[2*size+i]

    x_fourth_sector = np.empty(size)
    for i in range(size):
      x_fourth_sector[i] = massive1[3*size+i]

    y_first_sector = np.empty(size)
    for i in range(size):
      y_first_sector[i] = massive2[i]
    
    y_second_sector = np.empty(size)
    for i in range(size):
      y_second_sector[i] = massive2[size+i]

    y_third_sector = np.empty(size)
    for i in range(size):
      y_third_sector[i] = massive2[2*size+i]

    y_fourth_sector = np.empty(size)
    for i in range(size):
      y_fourth_sector[i] = massive2[3*size+i]

    ax = plt.gca()
    ax.spines['left'].set_position('center')
    ax.spines['bottom'].set_position('center')
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)

    ax.plot(x_first_sector, y_first_sector, 'k', label='0-180')
    ax.plot(x_second_sector, y_second_sector, 'r', label='180-360')
    ax.plot(x_third_sector, y_third_sector, 'g', label='360-540')
    ax.plot(x_fourth_sector, y_fourth_sector, 'b', label='540-720')

    if pos == line*column:
      plt.legend(bbox_to_anchor=(0.9, 0.3))

    plt.title(name)

  @classmethod
  def phase_shift_360(cls, massive2):
  
    print(massive2)

    size = len(massive2) // 2

    y_first_sector = np.empty(size)
    for i in range(size):
      y_first_sector[i] = massive2[i]

    y_second_sector = np.empty(size)
    for i in range(size):
      y_second_sector[i] = massive2[size+i]

    y = np.empty(len(massive2))

    y = np.append(y_second_sector, y_first_sector)
    # y = np.append(y_first_sector)

    print(y)

    return y

  def cartesian_graphic(self, massive1, massive2, name):

      size = len(massive1) // 4

      x_first_sector = np.empty(size)
      for i in range(size):
        x_first_sector[i] = massive1[i]

      x_second_sector = np.empty(size)
      for i in range(size):
        x_second_sector[i] = massive1[size+i]

      x_third_sector = np.empty(size)
      for i in range(size):
        x_third_sector[i] = massive1[2*size+i]

      x_fourth_sector = np.empty(size)
      for i in range(size):
        x_fourth_sector[i] = massive1[3*size+i]

      y_first_sector = np.empty(size)
      for i in range(size):
        y_first_sector[i] = massive2[i]
      
      y_second_sector = np.empty(size)
      for i in range(size):
        y_second_sector[i] = massive2[size+i]

      y_third_sector = np.empty(size)
      for i in range(size):
        y_third_sector[i] = massive2[2*size+i]

      y_fourth_sector = np.empty(size)
      for i in range(size):
        y_fourth_sector[i] = massive2[3*size+i]

      self.sc.axes.spines['left'].set_position('center')
      self.sc.axes.spines['bottom'].set_position('center')
      self.sc.axes.spines['top'].set_visible(False)
      self.sc.axes.spines['right'].set_visible(False)

      self.sc.axes.plot(x_first_sector, y_first_sector, 'k', label='0-180')
      self.sc.axes.plot(x_second_sector, y_second_sector, 'r', label='180-360')
      self.sc.axes.plot(x_third_sector, y_third_sector, 'g', label='360-540')
      self.sc.axes.plot(x_fourth_sector, y_fourth_sector, 'b', label='540-720')

    
      self.sc.axes.legend(bbox_to_anchor=(1, 0.6))

      self.sc.axes.set_title(name)

  def cartesian_graphic_for_save(self, massive1, massive2, name):

      size = len(massive1) // 4

      x_first_sector = np.empty(size)
      for i in range(size):
        x_first_sector[i] = massive1[i]

      x_second_sector = np.empty(size)
      for i in range(size):
        x_second_sector[i] = massive1[size+i]

      x_third_sector = np.empty(size)
      for i in range(size):
        x_third_sector[i] = massive1[2*size+i]

      x_fourth_sector = np.empty(size)
      for i in range(size):
        x_fourth_sector[i] = massive1[3*size+i]

      y_first_sector = np.empty(size)
      for i in range(size):
        y_first_sector[i] = massive2[i]
      
      y_second_sector = np.empty(size)
      for i in range(size):
        y_second_sector[i] = massive2[size+i]

      y_third_sector = np.empty(size)
      for i in range(size):
        y_third_sector[i] = massive2[2*size+i]

      y_fourth_sector = np.empty(size)
      for i in range(size):
        y_fourth_sector[i] = massive2[3*size+i]

      ax = plt.gca()
      ax.spines['left'].set_position('center')
      ax.spines['bottom'].set_position('center')
      ax.spines['top'].set_visible(False)
      ax.spines['right'].set_visible(False)

      ax.plot(x_first_sector, y_first_sector, 'k', label='0-180')
      ax.plot(x_second_sector, y_second_sector, 'r', label='180-360')
      ax.plot(x_third_sector, y_third_sector, 'g', label='360-540')
      ax.plot(x_fourth_sector, y_fourth_sector, 'b', label='540-720')

    
      plt.legend(bbox_to_anchor=(1, 0.6))

      plt.title(name)

  def set_point(self, x, y, type_dot, x1, y1, name):
    print('SET_POINT')
    self.sc.axes.set_title(name)
    self.sc.axes.set_xlabel('Rotation number [RPM]')
    self.sc.axes.plot(x, y, type_dot, x1, y1)
    print('SET_POINT')

  def set_point1(self, x, y, type_dot, name):
    print('SET_POINT')
    self.sc.axes.set_title(name)
    self.sc.axes.set_xlabel('Rotation number [RPM]')
    self.sc.axes.plot(x, y, type_dot)
    print('SET_POINT')

  def hmin_ugwt_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      # print("UGWT")
      # print(self.data.ugwt_mode1[1440:])
      self.ugwt_cartesian_graphic(self.data.ugwt_mode1[1440:], self.excel.hmin())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt_mode2[1440:], self.excel.hmin())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt_mode3[1440:], self.excel.hmin())

  def hmin1_ugwt1_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt1_mode1[1440:], self.excel.hmin1())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt1_mode2[1440:], self.excel.hmin1())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt1_mode3[1440:], self.excel.hmin1())

  def hmin2_ugwt2_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt2_mode1[1440:], self.excel.hmin2())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt2_mode2[1440:], self.excel.hmin2())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt2_mode3[1440:], self.excel.hmin2())

  def hmin3_ugwt3_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt3_mode1[1440:], self.excel.hmin3())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt3_mode2[1440:], self.excel.hmin3())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt3_mode3[1440:], self.excel.hmin3())

  def hmin4_ugwt4_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt4_mode1[1440:], self.excel.hmin4())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt4_mode2[1440:], self.excel.hmin4())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt4_mode3[1440:], self.excel.hmin4())

  def hmin5_ugwt5_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt5_mode1[1440:], self.excel.hmin5())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt5_mode2[1440:], self.excel.hmin5())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt5_mode3[1440:], self.excel.hmin5())

  def hmin6_ugwt6_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt6_mode1[1440:], self.excel.hmin6())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt6_mode2[1440:], self.excel.hmin6())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt6_mode3[1440:], self.excel.hmin6())

  def hmin7_ugwt7_cartesian_graphic(self):
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Oil Film Thickness')
    self.setTicks_for_ugm()
    if self.data.current_mode == 2:
      self.ugwt_cartesian_graphic(self.data.ugwt7_mode1[1440:], self.excel.hmin7())
    elif self.data.current_mode == 3:
      self.ugwt_cartesian_graphic(self.data.ugwt7_mode2[1440:], self.excel.hmin7())
    elif self.data.current_mode == 4:
      self.ugwt_cartesian_graphic(self.data.ugwt7_mode3[1440:], self.excel.hmin7())

  def ugwt_cartesian_graphic(self, angle, hmin):
    size = len(angle)//4
    print(f"SIZE {size}")

    theta_first_sector = np.empty(size)
    for i in range(size):
      theta_first_sector[i] = angle[i]

    theta_second_sector = np.empty(size)
    for i in range(size):
      theta_second_sector[i] = angle[size+i]

    theta_third_sector = np.empty(size)
    for i in range(size):
      theta_third_sector[i] = angle[2*size+i]

    theta_fourth_sector = np.empty(size)
    for i in range(size):
      theta_fourth_sector[i] = angle[3*size+i]

    fval_first_sector = np.empty(size)
    for i in range(size):
      print(hmin[i])
      fval_first_sector[i] = hmin[i]
    
    fval_second_sector = np.empty(size)
    for i in range(size):
      fval_second_sector[i] = hmin[size+i]

    fval_third_sector = np.empty(size)
    for i in range(size):
      fval_third_sector[i] = hmin[2*size+i]

    fval_fourth_sector = np.empty(size)
    for i in range(size):
      fval_fourth_sector[i] = hmin[3*size+i]

    self.sc.axes.plot(theta_first_sector, fval_first_sector, 'k.', label='0-180')
    self.sc.axes.plot(theta_second_sector, fval_second_sector, 'r.', label='180-360')
    self.sc.axes.plot(theta_third_sector, fval_third_sector, 'g.', label='360-540')
    self.sc.axes.plot(theta_fourth_sector, fval_fourth_sector, 'b.', label='540-720')
    # self.sc.axes.plot(theta1, [radius1 for i in theta1], 'c', label='максимум')

    self.sc.axes.legend(bbox_to_anchor=(1, 0.6))

  def dm_ugm_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm())-1):
    #   if abs((self.excel.ugm())[i] - (self.excel.ugm())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm())[begin:i+1], (self.excel.dm())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm())[begin:(len(self.excel.ugm())-1)], (self.excel.dm())[begin:(len(self.excel.ugm())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm(), self.excel.dm())

  def dm_ugm_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm())-1):
      if abs((self.excel.ugm())[i] - (self.excel.ugm())[i+1]) > 150:
        plt.plot((self.excel.ugm())[begin:i+1], (self.excel.dm())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm())[begin:(len(self.excel.ugm())-1)], (self.excel.dm())[begin:(len(self.excel.ugm())-1)], 'b')

  def dm1_ugm1_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm1())-1):
    #   if abs((self.excel.ugm1())[i] - (self.excel.ugm1())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm1())[begin:i+1], (self.excel.dm1())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm1())[begin:(len(self.excel.ugm1())-1)], (self.excel.dm1())[begin:(len(self.excel.ugm1())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm1(), self.excel.dm1())

  def dm1_ugm1_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm1')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm1())-1):
    #   if abs((self.excel.ugm1())[i] - (self.excel.ugm1())[i+1]) > 150:
    #     plt.plot((self.excel.ugm1())[begin:i+1], (self.excel.dm1())[begin:i+1], 'b')
    #     begin = i+1
    # plt.plot((self.excel.ugm1())[begin:(len(self.excel.ugm1())-1)], (self.excel.dm1())[begin:(len(self.excel.ugm1())-1)], 'b')
    # self.ugwt_cartesian_graphic(self.excel.ugm1(), self.excel.dm())

  def dm2_ugm2_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm2())-1):
    #   if abs((self.excel.ugm2())[i] - (self.excel.ugm2())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm2())[begin:i+1], (self.excel.dm2())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm2())[begin:(len(self.excel.ugm2())-1)], (self.excel.dm2())[begin:(len(self.excel.ugm2())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm2(), self.excel.dm2())

  def dm2_ugm2_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm2')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm2())-1):
      if abs((self.excel.ugm2())[i] - (self.excel.ugm2())[i+1]) > 150:
        plt.plot((self.excel.ugm2())[begin:i+1], (self.excel.dm2())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm2())[begin:(len(self.excel.ugm2())-1)], (self.excel.dm2())[begin:(len(self.excel.ugm2())-1)], 'b')

  def dm3_ugm3_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm3())-1):
    #   if abs((self.excel.ugm3())[i] - (self.excel.ugm3())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm3())[begin:i+1], (self.excel.dm3())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm3())[begin:(len(self.excel.ugm3())-1)], (self.excel.dm3())[begin:(len(self.excel.ugm3())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm3(), self.excel.dm3())

  def dm3_ugm3_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm3')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm3())-1):
      if abs((self.excel.ugm3())[i] - (self.excel.ugm3())[i+1]) > 150:
        plt.plot((self.excel.ugm3())[begin:i+1], (self.excel.dm3())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm3())[begin:(len(self.excel.ugm3())-1)], (self.excel.dm3())[begin:(len(self.excel.ugm3())-1)], 'b')

  def dm4_ugm4_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm4())-1):
    #   if abs((self.excel.ugm4())[i] - (self.excel.ugm4())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm4())[begin:i+1], (self.excel.dm4())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm4())[begin:(len(self.excel.ugm4())-1)], (self.excel.dm4())[begin:(len(self.excel.ugm4())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm4(), self.excel.dm4())

  def dm4_ugm4_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm4')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm4())-1):
      if abs((self.excel.ugm4())[i] - (self.excel.ugm4())[i+1]) > 150:
        plt.plot((self.excel.ugm4())[begin:i+1], (self.excel.dm4())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm4())[begin:(len(self.excel.ugm4())-1)], (self.excel.dm4())[begin:(len(self.excel.ugm4())-1)], 'b')

  def dm5_ugm5_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm5())-1):
    #   if abs((self.excel.ugm5())[i] - (self.excel.ugm5())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm5())[begin:i+1], (self.excel.dm5())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm5())[begin:(len(self.excel.ugm5())-1)], (self.excel.dm5())[begin:(len(self.excel.ugm5())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm5(), self.excel.dm5())

  def dm5_ugm5_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm5')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm5())-1):
    #   if abs((self.excel.ugm5())[i] - (self.excel.ugm5())[i+1]) > 150:
    #     plt.plot((self.excel.ugm5())[begin:i+1], (self.excel.dm5())[begin:i+1], 'b')
    #     begin = i+1
    # plt.plot((self.excel.ugm5())[begin:(len(self.excel.ugm5())-1)], (self.excel.dm5())[begin:(len(self.excel.ugm5())-1)], 'b')
    # self.ugwt_cartesian_graphic(self.excel.ugm(), self.excel.dm())

  def dm6_ugm6_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm6())-1):
    #   if abs((self.excel.ugm6())[i] - (self.excel.ugm6())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm6())[begin:i+1], (self.excel.dm6())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm6())[begin:(len(self.excel.ugm6())-1)], (self.excel.dm6())[begin:(len(self.excel.ugm6())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm6(), self.excel.dm6())

  def dm6_ugm6_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugm6')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm6())-1):
      if abs((self.excel.ugm6())[i] - (self.excel.ugm6())[i+1]) > 150:
        plt.plot((self.excel.ugm6())[begin:i+1], (self.excel.dm6())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm6())[begin:(len(self.excel.ugm6())-1)], (self.excel.dm6())[begin:(len(self.excel.ugm6())-1)], 'b')

  def dm7_ugm7_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Bearing angle')
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugm7())-1):
    #   if abs((self.excel.ugm7())[i] - (self.excel.ugm7())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugm7())[begin:i+1], (self.excel.dm7())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugm7())[begin:(len(self.excel.ugm7())-1)], (self.excel.dm7())[begin:(len(self.excel.ugm7())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugm7(), self.excel.dm7())

  def dm7_ugm7_cartesian_graphic_for_save(self):
    plt.title('Film Pressure  vs Bearing angle')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugm7())-1):
      if abs((self.excel.ugm7())[i] - (self.excel.ugm7())[i+1]) > 150:
        plt.plot((self.excel.ugm7())[begin:i+1], (self.excel.dm7())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugm7())[begin:(len(self.excel.ugm7())-1)], (self.excel.dm7())[begin:(len(self.excel.ugm7())-1)], 'b')

  def dm_ugw_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw())-1):
    #   if abs((self.excel.ugw())[i] - (self.excel.ugw())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw())[begin:i+1], (self.excel.dm())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw())[begin:(len(self.excel.ugw())-1)], (self.excel.dm())[begin:(len(self.excel.ugw())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw(), self.excel.dm())

  def dm_ugw_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw())-1):
      if abs((self.excel.ugw())[i] - (self.excel.ugw())[i+1]) > 150:
        plt.plot((self.excel.ugw())[begin:i+1], (self.excel.dm())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw())[begin:(len(self.excel.ugw())-1)], (self.excel.dm())[begin:(len(self.excel.ugw())-1)], 'b')

  def dm1_ugw1_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw1())-1):
    #   if abs((self.excel.ugw1())[i] - (self.excel.ugw1())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw1())[begin:i+1], (self.excel.dm1())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw1())[begin:(len(self.excel.ugw1())-1)], (self.excel.dm1())[begin:(len(self.excel.ugw1())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw1(), self.excel.dm1())

  def dm1_ugw1_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw1')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw1())-1):
      if abs((self.excel.ugw1())[i] - (self.excel.ugw1())[i+1]) > 150:
        plt.plot((self.excel.ugw1())[begin:i+1], (self.excel.dm1())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw1())[begin:(len(self.excel.ugw1())-1)], (self.excel.dm1())[begin:(len(self.excel.ugw1())-1)], 'b')

  def dm2_ugw2_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw2())-1):
    #   if abs((self.excel.ugw2())[i] - (self.excel.ugw2())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw2())[begin:i+1], (self.excel.dm2())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw2())[begin:(len(self.excel.ugw2())-1)], (self.excel.dm2())[begin:(len(self.excel.ugw2())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw2(), self.excel.dm2())

  def dm2_ugw2_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw2')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw2())-1):
      if abs((self.excel.ugw2())[i] - (self.excel.ugw2())[i+1]) > 150:
        plt.plot((self.excel.ugw2())[begin:i+1], (self.excel.dm2())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw2())[begin:(len(self.excel.ugw2())-1)], (self.excel.dm2())[begin:(len(self.excel.ugw2())-1)], 'b')

  def dm3_ugw3_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw3())-1):
    #   if abs((self.excel.ugw3())[i] - (self.excel.ugw3())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw3())[begin:i+1], (self.excel.dm3())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw3())[begin:(len(self.excel.ugw3())-1)], (self.excel.dm3())[begin:(len(self.excel.ugw3())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw3(), self.excel.dm3())

  def dm3_ugw3_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw3')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw3())-1):
    #   if abs((self.excel.ugw3())[i] - (self.excel.ugw3())[i+1]) > 150:
    #     plt.plot((self.excel.ugw3())[begin:i+1], (self.excel.dm3())[begin:i+1], 'b')
    #     begin = i+1
    # plt.plot((self.excel.ugw3())[begin:(len(self.excel.ugw3())-1)], (self.excel.dm3())[begin:(len(self.excel.ugw3())-1)], 'b')
    # self.ugwt_cartesian_graphic(self.excel.ugw(), self.excel.dm())

  def dm4_ugw4_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw4())-1):
    #   if abs((self.excel.ugw4())[i] - (self.excel.ugw4())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw4())[begin:i+1], (self.excel.dm4())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw4())[begin:(len(self.excel.ugw4())-1)], (self.excel.dm4())[begin:(len(self.excel.ugw4())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw4(), self.excel.dm4())

  def dm4_ugw4_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw4')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw4())-1):
      if abs((self.excel.ugw4())[i] - (self.excel.ugw4())[i+1]) > 150:
        plt.plot((self.excel.ugw4())[begin:i+1], (self.excel.dm4())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw4())[begin:(len(self.excel.ugw4())-1)], (self.excel.dm4())[begin:(len(self.excel.ugw4())-1)], 'b')

  def dm5_ugw5_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw5())-1):
    #   if abs((self.excel.ugw5())[i] - (self.excel.ugw5())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw5())[begin:i+1], (self.excel.dm5())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw5())[begin:(len(self.excel.ugw5())-1)], (self.excel.dm5())[begin:(len(self.excel.ugw5())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw5(), self.excel.dm5())

  def dm5_ugw5_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw5')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw5())-1):
      if abs((self.excel.ugw5())[i] - (self.excel.ugw5())[i+1]) > 150:
        plt.plot((self.excel.ugw5())[begin:i+1], (self.excel.dm5())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw5())[begin:(len(self.excel.ugw5())-1)], (self.excel.dm5())[begin:(len(self.excel.ugw5())-1)], 'b')

  def dm6_ugw6_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw6())-1):
    #   if abs((self.excel.ugw6())[i] - (self.excel.ugw6())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw6())[begin:i+1], (self.excel.dm6())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw6())[begin:(len(self.excel.ugw6())-1)], (self.excel.dm6())[begin:(len(self.excel.ugw6())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw6(), self.excel.dm6())

  def dm6_ugw6_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw6')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw6())-1):
      if abs((self.excel.ugw6())[i] - (self.excel.ugw6())[i+1]) > 150:
        plt.plot((self.excel.ugw6())[begin:i+1], (self.excel.dm6())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw6())[begin:(len(self.excel.ugw6())-1)], (self.excel.dm6())[begin:(len(self.excel.ugw6())-1)], 'b')

  def dm7_ugw7_cartesian_graphic(self):
    self.sc.axes.set_title('PRESSURE DISTRIBUTION: Film Pressure  vs Shaft angle')
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_ylabel('Film Pressure, MPa')
    self.setTicks_for_ugm()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    # begin = 0
    # for i in range(len(self.excel.ugw7())-1):
    #   if abs((self.excel.ugw7())[i] - (self.excel.ugw7())[i+1]) > 150:
    #     self.sc.axes.plot((self.excel.ugw7())[begin:i+1], (self.excel.dm7())[begin:i+1], 'b')
    #     begin = i+1
    # self.sc.axes.plot((self.excel.ugw7())[begin:(len(self.excel.ugw7())-1)], (self.excel.dm7())[begin:(len(self.excel.ugw7())-1)], 'b')
    self.ugwt_cartesian_graphic(self.excel.ugw7(), self.excel.dm7())

  def dm7_ugw7_cartesian_graphic_for_save(self):
    plt.title('Давление масляной плёнки ugw7')
    plt.xlabel('Угол КВ, град')
    # self.sc.axes.set_ylabel('Давление, кг/см2')
    self.setTicks_for_ugm_save()
    # self.sc.axes.plot(self.excel.dm(), self.excel.ugm())
    begin = 0
    for i in range(len(self.excel.ugw7())-1):
      if abs((self.excel.ugw7())[i] - (self.excel.ugw7())[i+1]) > 150:
        plt.plot((self.excel.ugw7())[begin:i+1], (self.excel.dm7())[begin:i+1], 'b')
        begin = i+1
    plt.plot((self.excel.ugw7())[begin:(len(self.excel.ugw7())-1)], (self.excel.dm7())[begin:(len(self.excel.ugw7())-1)], 'b')

  @classmethod
  def TN_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN()))

  def TN_graphic_for_save(self):
    plt.title('TN')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN())

  @classmethod
  def TN1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN1()))

  def TN1_graphic_for_save(self):
    plt.title('TN1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN1())

  @classmethod
  def TN2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN2()))

  def TN2_graphic_for_save(self):
    plt.title('TN2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN2())

  @classmethod
  def TN3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN3()))

  def TN3_graphic_for_save(self):
    plt.title('TN3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN3())

  @classmethod
  def TN4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN4()))

  def TN4_graphic_for_save(self):
    plt.title('TN4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN4())

  @classmethod
  def TN5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN5()))

  def TN5_graphic_for_save(self):
    plt.title('TN5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN5())

  @classmethod
  def TN6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN6()))

  def TN6_graphic_for_save(self):
    plt.title('TN6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN6())

  @classmethod
  def TN7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('POWER LOSS')
    obj.sc.axes.set_xlabel('Crank Angle')
    obj.sc.axes.set_ylabel('POWER LOSS, kW')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.TN7()))

  def TN7_graphic_for_save(self):
    plt.title('TN7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Мощность, кВт')
    self.setTicks_for_plt()
    plt.plot(self.excel.TN7())

  @classmethod
  def PIND_graphic(cls, obj, operation):
    obj.sc.axes.set_title('CYLINDER PRESSURE')
    obj.sc.axes.set_xlabel('Crank Angle [degrees]')
    obj.sc.axes.set_ylabel('Cylinder Pressure [kg*f/cm²]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getPIND()))
    # self.sc.axes.set_tight_layout()

  def first_page_graphics(self):
    plt.title('PIND')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, кг/см2')
    plt.plot(self.phase_shift_360(self.excel.getPIND()))
    plt.tight_layout()
    
  @classmethod
  def FSUM_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM()))

  def FSUM_graphic_for_save(self):
    plt.title('FSUM')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM())

    # self.layout.addWidget(self.sc)
    
    # self.setLayout(self.layout)
    # toolbar = NavigationToolbar(self.sc, self)

    # layout = QtWidgets.QVBoxLayout()
    # layout.addWidget(toolbar)
    # layout.addWidget(self.sc)
    
    # self.setLayout(layout)
  @classmethod
  def beta_graphic(cls, obj, operation):
    obj.sc.axes.set_title('beta')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA()))

  def beta_graphic_for_save(self):
    plt.title('beta')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA())

  @classmethod
  def GAM_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM()))

  def GAM_graphic_for_save(self):
    plt.title('GAM')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM())

  def FSUM_BETA_graphic(self):
    self.polar_graphic(self.excel.getFSUM(), self.excel.getBETA(), 'FSUM - BETA')

  def FSUM_GAM_graphic(self):
    self.polar_graphic(self.excel.getFSUM(), self.excel.getGAM(), 'FSUM - GAM')

  def second_page_graphics(self):
    plt.subplot(2, 2, 1)
    self.FSUM_graphic()
    plt.tight_layout()

    plt.subplot(2, 2, 2)
    self.beta_graphic()
    plt.tight_layout()
    plt.subplot(2, 2, 3)
    self.GAM_graphic()
    plt.tight_layout()

    self.draw_polar_graphic(self.excel.getFSUM(), self.excel.getBETA(), 2, 2, 4, 'FSUM - BETA')

  @classmethod
  def FSUM1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM1()))

  def FSUM1_graphic_for_save(self):
    plt.title('FSUM1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM1())

  @classmethod
  def FSUM2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()  
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM2()))

  def FSUM2_graphic_for_save(self):
    plt.title('FSUM2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')  
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM2())

  @classmethod
  def FSUM3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM3()))

  def FSUM3_graphic_for_save(self):
    plt.title('FSUM3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM3())
### BEGIN

  @classmethod
  def FSUM4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM4()))

  def FSUM4_graphic_for_save(self):
    plt.title('FSUM4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM4())

  @classmethod
  def FSUM5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM5()))

  def FSUM5_graphic_for_save(self):
    plt.title('FSUM5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM5())

  @classmethod
  def FSUM6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM6()))
  
  def FSUM6_graphic_for_save(self):
    plt.title('FSUM6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM6())
  
  @classmethod
  def FSUM7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('LOAD (N)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Сила, Н')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.getFSUM7()))

  def FSUM7_graphic_for_save(self):
    plt.title('FSUM7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Сила, Н')
    self.setTicks_for_plt()
    plt.plot(self.excel.getFSUM7())

### END

  @classmethod
  def BETA1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA1')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA1()))

  def BETA1_graphic_for_save(self):
    plt.title('BETA1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA1())

  @classmethod
  def BETA2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA2')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA2()))

  def BETA2_graphic_for_save(self):
    plt.title('BETA2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA2())   

  @classmethod
  def BETA3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA3')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA3()))

  def BETA3_graphic_for_save(self):
    plt.title('BETA3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA3())

### BEGIN
  
  @classmethod
  def BETA4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA4')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA4()))

  def BETA4_graphic_for_save(self):
    plt.title('BETA4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA4())

  @classmethod
  def BETA5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA5')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA5()))

  def BETA5_graphic_for_save(self):
    plt.title('BETA5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA5())

  @classmethod
  def BETA6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA6')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA6()))

  def BETA6_graphic_for_save(self):
    plt.title('BETA6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA6())

  @classmethod
  def BETA7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('BETA7')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getBETA7()))

  def BETA7_graphic_for_save(self):
    plt.title('BETA7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getBETA7())

### END
  
  @classmethod
  def GAM1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM1')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM1()))

  def GAM1_graphic_for_save(self):
    plt.title('GAM1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM1())

  @classmethod
  def GAM2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM2')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM2()))

  def GAM2_graphic_for_save(self):
    plt.title('GAM2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM2())

  @classmethod
  def GAM3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM3')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM3()))

  def GAM3_graphic_for_save(self):
    plt.title('GAM3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM3())

### BEGIN

  @classmethod
  def GAM4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM4')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM4()))

  def GAM4_graphic_for_save(self):
    plt.title('GAM4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM4())

  @classmethod
  def GAM5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM5')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM5()))

  def GAM5_graphic_for_save(self):
    plt.title('GAM5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM5())

  @classmethod
  def GAM6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM6')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM6()))

  def GAM6_graphic_for_save(self):
    plt.title('GAM6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM6())
  
  @classmethod
  def GAM7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('GAM7')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.getGAM7()))

  def GAM7_graphic_for_save(self):
    plt.title('GAM7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.getGAM7())

### END

  def FSUM1_BETA1_graphic(self):
    self.polar_graphic(self.excel.getFSUM1(), self.excel.getBETA1(), "FSUM1 - BETA1")

  def FSUM2_BETA2_graphic(self):
    self.polar_graphic(self.excel.getFSUM2(), self.excel.getBETA2(), "FSUM2 - BETA2")

  def FSUM3_BETA3_graphic(self):
    self.polar_graphic(self.excel.getFSUM3(), self.excel.getBETA3(), "FSUM3 - BETA3")

### BEGIN
  
  def FSUM4_BETA4_graphic(self):
     self.polar_graphic(self.excel.getFSUM4(), self.excel.getBETA4(), "FSUM4 - BETA4")

  def FSUM5_BETA5_graphic(self):
     self.polar_graphic(self.excel.getFSUM5(), self.excel.getBETA5(), "FSUM5 - BETA5")

  def FSUM6_BETA6_graphic(self):
     self.polar_graphic(self.excel.getFSUM6(), self.excel.getBETA6(), "FSUM6 - BETA6")

  def FSUM7_BETA7_graphic(self):
     self.polar_graphic(self.excel.getFSUM7(), self.excel.getBETA7(), "FSUM7 - BETA7")

### END

  def FSUM1_GAM1_graphic(self):
    self.polar_graphic(self.excel.getFSUM1(), self.excel.getGAM1(), "FSUM1 - GAM1")

  def FSUM2_GAM2_graphic(self):
    self.polar_graphic(self.excel.getFSUM2(), self.excel.getGAM2(), "FSUM2 - GAM2")

  def FSUM3_GAM3_graphic(self):
    self.polar_graphic(self.excel.getFSUM3(), self.excel.getGAM3(), "FSUM3 - GAM3")   

# BEGIN
     
  def FSUM4_GAM4_graphic(self):
    self.polar_graphic(self.excel.getFSUM4(), self.excel.getGAM4(), "FSUM4 - GAM4")

  def FSUM5_GAM5_graphic(self):
    self.polar_graphic(self.excel.getFSUM5(), self.excel.getGAM5(), "FSUM5 - GAM5")

  def FSUM6_GAM6_graphic(self):
    self.polar_graphic(self.excel.getFSUM6(), self.excel.getGAM6(), "FSUM6 - GAM6")

  def FSUM7_GAM7_graphic(self):
    self.polar_graphic(self.excel.getFSUM7(), self.excel.getGAM7(), "FSUM7 - GAM7")

  def dm_ugm_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm(), self.excel.ugm(), "dm - ugm", 0)

  def dm1_ugm1_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm1(), self.excel.ugm1(), "dm1 - ugm1", 1)

  def dm2_ugm2_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm2(), self.excel.ugm2(), "dm2 - ugm2", 2)
  
  def dm3_ugm3_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm3(), self.excel.ugm3(), "dm3 - ugm3", 3)

  def dm4_ugm4_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm4(), self.excel.ugm4(), "dm4 - ugm4", 4)

  def dm5_ugm5_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm5(), self.excel.ugm5(), "dm5 - ugm5", 5)

  def dm6_ugm6_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm6(), self.excel.ugm6(), "dm6 - ugm6", 6)

  def dm7_ugm7_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm7(), self.excel.ugm7(), "dm7 - ugm7", 7)

  def dm_ugw_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm(), self.excel.ugw(), "dm - ugw", 0)

  def dm1_ugw1_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm1(), self.excel.ugw1(), "dm1 - ugw1", 1)

  def dm2_ugw2_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm2(), self.excel.ugw2(), "dm2 - ugw2", 2)

  def dm3_ugw3_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm3(), self.excel.ugw3(), "dm3 - ugw3", 3)

  def dm4_ugw4_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm4(), self.excel.ugw4(), "dm4 - ugw4", 4)

  def dm5_ugw5_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm5(), self.excel.ugw5(), "dm5 - ugw5", 5)

  def dm6_ugw6_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm6(), self.excel.ugw6(), "dm6 - ugw6", 6)
    
  def dm7_ugw7_for_save(self):
     self.polar_graphic_dm_save(self.excel.dm7(), self.excel.ugw7(), "dm7 - ugw7", 7)
 
  
# END
    
  def draw_third_page_graphics(self):
    plt.subplot(3, 3, 1)
    self.FSUM1_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 2)
    self.FSUM2_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 3)
    self.FSUM3_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 4)
    self.BETA1_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 5)
    self.BETA2_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 6)
    self.BETA3_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 7)
    self.GAM1_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 8)
    self.GAM2_graphic()
    plt.tight_layout()

    plt.subplot(3, 3, 9)
    self.GAM3_graphic()
    plt.tight_layout()

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

    fig = plt.figure()
    # fig.tight_layout(h_pad= 10)

    self.draw_polar_graphic(self.excel.getFSUM1(), self.excel.getBETA1(), 2, 3, 1, "FSUM1 - BETA1")
    self.draw_polar_graphic(self.excel.getFSUM2(), self.excel.getBETA2(), 2, 3, 2, "FSUM2 - BETA2")
    fig.tight_layout()
    self.draw_polar_graphic(self.excel.getFSUM3(), self.excel.getBETA3(), 2, 3, 3, "FSUM3 - BETA3")
    

    self.draw_polar_graphic(self.excel.getFSUM1(), self.excel.getGAM1(), 2, 3, 4, "FSUM1 - GAM1")
    self.draw_polar_graphic(self.excel.getFSUM2(), self.excel.getGAM2(), 2, 3, 5, "FSUM2 - GAM2")
    self.draw_polar_graphic(self.excel.getFSUM3(), self.excel.getGAM3(), 2, 3, 6, "FSUM3 - GAM3")    

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

  def dm_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm())

  def dm1_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm1())

  def dm2_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm2())

  def dm3_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm3())

  def dm4_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm4())

  def dm5_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm5())

  def dm6_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm6())

  def dm7_graphic(self):
    self.sc.axes.set_title('MAX. OIL FILM PRESSURE vs Crank angle')
    self.sc.axes.set_xlabel('Crank Angle [deg.]')
    self.sc.axes.set_ylabel('MOFP [MPa]')
    self.setTicks()
    self.sc.axes.set_xlim(left=0)
    self.sc.axes.plot(self.excel.dm7())

  @classmethod
  def PSUM_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM()))

  def PSUM_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM())

  @classmethod
  def PSUM1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM1()))

  def PSUM1_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM1())

  @classmethod
  def PSUM2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM2()))

  def PSUM2_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM2())

  @classmethod
  def PSUM3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM3()))

  def PSUM3_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM3())

  @classmethod
  def PSUM4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM4()))

  def PSUM4_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM4())

### BEGIN

  @classmethod
  def PSUM5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM5()))

  def PSUM5_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM5())

  @classmethod
  def PSUM6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM6()))

  def PSUM6_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM6())

  @classmethod
  def PSUM7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Давление, MПa')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.PSUM7()))

  def PSUM7_graphic_for_save(self):
    plt.title('SPECIFIC LOAD (MPa)  -  CRANK ANGLE')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Давление, MПa')
    self.setTicks_for_plt()
    plt.plot(self.excel.PSUM7())

### END

  @classmethod
  def hmin_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin()))

  def hmin_graphic_for_save(self):
    plt.title('hmin')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin())

  @classmethod
  def hmin1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin1()))

  def hmin1_graphic_for_save(self):
    plt.title('hmin1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin1())

  @classmethod
  def hmin2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin2()))

  def hmin2_graphic_for_save(self):
    plt.title('hmin2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin2())

  @classmethod
  def hmin3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin3()))

  def hmin3_graphic_for_save(self):
    plt.title('hmin3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin3())

  @classmethod
  def hmin4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin4()))

  def hmin4_graphic_for_save(self):
    plt.title('hmin4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin4())

### BEGIN
  
  @classmethod
  def hmin5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin5()))

  def hmin5_graphic_for_save(self):
    plt.title('hmin5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin5())
  
  @classmethod
  def hmin6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin6()))

  def hmin6_graphic_for_save(self):
    plt.title('hmin6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin6())

  @classmethod
  def hmin7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('Hmin  vs  CRANK ANGLE ')
    obj.sc.axes.set_xlabel('Crank Angle [deg.]')
    obj.sc.axes.set_ylabel('MOFT [mm]')
    obj.setTicks()
    obj.sc.axes.set_xlim(left=0)
    obj.sc.axes.plot(operation(cls.excel.hmin7()))

  def hmin7_graphic_for_save(self):
    plt.title('hmin7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Толщина, мм')
    self.setTicks_for_plt()
    plt.plot(self.excel.hmin7())
    
### END

  def yg_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg(), self.excel.yg(), "yg-неподвижный подшипник")

  def yg_shaft_graphic(self):
    self.cartesian_graphic(self.excel.xq(), self.excel.yq(), "yg-неподвижный вал")

  def yg1_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg1(), self.excel.yg1(), "yg1-неподвижный подшипник")

  def yg1_shaft_graphic(self):
    self.cartesian_graphic(self.excel.xq1(), self.excel.yq1(), "yg1 - неподвижный вал")

  def yg2_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg2(), self.excel.yg2(), "yg2-неподвижный подшипник")
  
  def yg2_shaft_graphic(self):
    self.cartesian_graphic(self.excel.xq2(), self.excel.yq2(), "yg2 - неподвижный вал")

  def yg3_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg3(), self.excel.yg3(), "yg3-неподвижный подшипник")

  def yg3_shaft_graphic(self):
    self.cartesian_graphic(self.excel.xq3(), self.excel.yq3(), "yg3 - неподвижный вал")

  def yg4_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg4(), self.excel.yg4(), "yg4-неподвижный подшипник")

  def yg4_shaft_graphic(self): 
    self.cartesian_graphic(self.excel.xq4(), self.excel.yq4(), "yg4 - неподвижный вал")

### BEGIN
  
  def yg5_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg5(), self.excel.yg5(), "yg5-неподвижный подшипник")

  def yg5_shaft_graphic(self): 
    self.cartesian_graphic(self.excel.xq5(), self.excel.yq5(), "yg5 - неподвижный вал")

  def yg6_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg6(), self.excel.yg6(), "yg6-неподвижный подшипник")

  def yg6_shaft_graphic(self): 
    self.cartesian_graphic(self.excel.xq6(), self.excel.yq6(), "yg6 - неподвижный вал")

  def yg7_bearing_graphic(self):
    self.cartesian_graphic(self.excel.xg7(), self.excel.yg7(), "yg7-неподвижный подшипник")

  def yg7_shaft_graphic(self): 
    self.cartesian_graphic(self.excel.xq7(), self.excel.yq7(), "yg7 - неподвижный вал")

### END
  
  def yg_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg(), self.excel.yg(), "yg-неподвижный подшипник")

  def yg_shaft_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xq(), self.excel.yq(), "yg-неподвижный вал")

  def yg1_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg1(), self.excel.yg1(), "yg1-неподвижный подшипник")

  def yg1_shaft_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xq1(), self.excel.yq1(), "yg1 - неподвижный вал")

  def yg2_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg2(), self.excel.yg2(), "yg2-неподвижный подшипник")
  
  def yg2_shaft_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xq2(), self.excel.yq2(), "yg2 - неподвижный вал")

  def yg3_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg3(), self.excel.yg3(), "yg3-неподвижный подшипник")

  def yg3_shaft_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xq3(), self.excel.yq3(), "yg3 - неподвижный вал")

  def yg4_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg4(), self.excel.yg4(), "yg4-неподвижный подшипник")

  def yg4_shaft_graphic_for_save(self): 
    self.cartesian_graphic_for_save(self.excel.xq4(), self.excel.yq4(), "yg4 - неподвижный вал")
  
  def yg5_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg5(), self.excel.yg5(), "yg5-неподвижный подшипник")

  def yg5_shaft_graphic_for_save(self): 
    self.cartesian_graphic_for_save(self.excel.xq5(), self.excel.yq5(), "yg5 - неподвижный вал")

  def yg6_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg6(), self.excel.yg6(), "yg6-неподвижный подшипник")

  def yg6_shaft_graphic_for_save(self): 
    self.cartesian_graphic_for_save(self.excel.xq6(), self.excel.yq6(), "yg6 - неподвижный вал")

  def yg7_bearing_graphic_for_save(self):
    self.cartesian_graphic_for_save(self.excel.xg7(), self.excel.yg7(), "yg7-неподвижный подшипник")

  def yg7_shaft_graphic_for_save(self): 
    self.cartesian_graphic_for_save(self.excel.xq7(), self.excel.yq7(), "yg7 - неподвижный вал")

  

  @classmethod
  def ugm_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm()))

  def ugm_graphic_for_save(self):
    plt.title('ugm')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm())

  @classmethod
  def ugw_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw()))

  def ugw_graphic_for_save(self):
    plt.title('ugw')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw())

  @classmethod
  def ugm1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm1')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm1()))

  def ugm1_graphic_for_save(self):
    plt.title('ugm1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm1())

  @classmethod
  def ugw1_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw1')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw1()))

  def ugw1_graphic_for_save(self):
    plt.title('ugw1')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw1())

  @classmethod
  def ugm2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm2')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm2()))

  def ugm2_graphic_for_save(self):
    plt.title('ugm2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm2())

  @classmethod
  def ugw2_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw2')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw2()))

  def ugw2_graphic_for_save(self):
    plt.title('ugw2')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw2())

  @classmethod
  def ugm3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm3')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm3()))

  def ugm3_graphic_for_save(self):
    plt.title('ugm3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm3())

  @classmethod
  def ugw3_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw3')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw3()))

  def ugw3_graphic_for_save(self):
    plt.title('ugw3')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw3())

  @classmethod
  def ugm4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm4')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm4()))

  def ugm4_graphic_for_save(self):
    plt.title('ugm4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm4())

  @classmethod
  def ugw4_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw4')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw4()))

  def ugw4_graphic_for_save(self):
    plt.title('ugw4')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw4())

### BEGIN
  
  @classmethod
  def ugm5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm5')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm5()))

  def ugm5_graphic_for_save(self):
    plt.title('ugm5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm5())

  @classmethod
  def ugw5_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw5')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw5()))

  def ugw5_graphic_for_save(self):
    plt.title('ugw5')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw5())

  @classmethod
  def ugm6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm6')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm6()))

  def ugm6_graphic_for_save(self):
    plt.title('ugm6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm6())

  @classmethod
  def ugw6_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw6')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw6()))

  def ugw6_graphic_for_save(self):
    plt.title('ugw6')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw6())

  @classmethod
  def ugm7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugm7')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugm7()))

  def ugm7_graphic_for_save(self):
    plt.title('ugm7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugm7())

  @classmethod
  def ugw7_graphic(cls, obj, operation):
    obj.sc.axes.set_title('ugw7')
    obj.sc.axes.set_xlabel('Угол КВ, град')
    obj.sc.axes.set_ylabel('Угол, град')
    obj.setTicks()
    obj.sc.axes.plot(operation(cls.excel.ugw7()))

  def ugw7_graphic_for_save(self):
    plt.title('ugw7')
    plt.xlabel('Угол КВ, град')
    plt.ylabel('Угол, град')
    self.setTicks_for_plt()
    plt.plot(self.excel.ugw7())

  def FMAX_base(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_base())):
      index.append(i)
    for i in range(len(self.excel.FMAX_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_base(), dtype="object")
    self.sc.axes.bar(index, self.excel.FMAX_base())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Specific Load')
    self.sc.axes.set_ylabel('Specific Load, MPa')
    self.sc.axes.set_xlabel('Bearing')

  def FMAX_base_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_base())):
      index.append(i)
    for i in range(len(self.excel.FMAX_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_base(), dtype="object")

    ax = plt.gca()
    ax.bar(index, self.excel.FMAX_base())
    ax.set_xticks(index, xnames)

    ax.set_title('Specific Load')
    ax.set_ylabel('Specific Load, MPa')
    ax.set_xlabel('Bearing')

  def FMAX_l4_v8(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.FMAX_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_l4_v8(), dtype="object")

    self.sc.axes.bar(index, self.excel.FMAX_l4_v8())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Specific Load')
    self.sc.axes.set_ylabel('Specific Load, MPa')
    self.sc.axes.set_xlabel('Bearing')

  def FMAX_l4_v8_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.FMAX_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_l4_v8(), dtype="object")

    ax = plt.gca()
    ax.bar(index, self.excel.FMAX_l4_v8())
    ax.set_xticks(index, xnames)

    ax.set_title('Specific Load')
    ax.set_ylabel('Specific Load, MPa')
    ax.set_xlabel('Bearing')

  def FMAX_l6_v12(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.FMAX_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_l6_v12(), dtype="object")
    print(len(index))
    # print(len(np_array_of_objects))
    print(len(xnames))
    self.sc.axes.bar(index, self.excel.FMAX_l6_v12())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Specific Load')
    self.sc.axes.set_ylabel('Specific Load, MPa')
    self.sc.axes.set_xlabel('Bearing')

  def FMAX_l6_v12_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.FMAX_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.FMAX_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    # np_array_of_objects = np.asarray(self.excel.FMAX_l6_v12(), dtype="object")
    print(len(index))
    # print(len(np_array_of_objects))
    print(len(xnames))
    ax = plt.gca()
    ax.bar(index, self.excel.FMAX_l6_v12())
    ax.set_xticks(index, xnames)

    ax.set_title('Specific Load')
    ax.set_ylabel('Specific Load, MPa')
    ax.set_xlabel('Bearing')

  def dm_base(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_base())):
      index.append(i)
    for i in range(len(self.excel.dm_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.dm_base(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Max. Oil Film Pressure')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFP, MPa')

  def dm_base_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_base())):
      index.append(i)
    for i in range(len(self.excel.dm_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.dm_base(), dtype="object")

    plt.bar(index, np_array_of_objects)
    plt.xticks(index, xnames)
    plt.title('Max. Oil Film Pressure')
    plt.xlabel('Bearing')
    plt.ylabel('MOFP, MPa')

  def dm_l4_v8(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.dm_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.dm_l4_v8(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Max. Oil Film Pressure')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFP, MPa')

  def dm_l4_v8_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.dm_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.dm_l4_v8(), dtype="object")

    plt.bar(index, np_array_of_objects)
    plt.xticks(index, xnames)

    plt.title('Max. Oil Film Pressure')
    plt.xlabel('Bearing')
    plt.ylabel('MOFP, MPa')

  def dm_l6_v12(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.dm_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    self.sc.axes.bar(index, self.excel.dm_l6_v12())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Max. Oil Film Pressure')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFP, MPa')

  def dm_l6_v12_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.dm_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.dm_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    plt.bar(index, self.excel.dm_l6_v12())
    plt.xticks(index, xnames)

    plt.title('Max. Oil Film Pressure')
    plt.xlabel('Bearing')
    plt.ylabel('MOFP, MPa')

  def TN_base(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_base())):
      index.append(i)
    for i in range(len(self.excel.TN_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.TN_base(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Power Loss')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('Power Loss, kW')

  def TN_base_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_base())):
      index.append(i)
    for i in range(len(self.excel.TN_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.TN_base(), dtype="object")

    plt.bar(index, np_array_of_objects)
    plt.xticks(index, xnames)

    plt.title('Power Loss')
    plt.xlabel('Bearing')
    plt.ylabel('Power Loss, kW')

  def TN_l4_v8(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.TN_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.TN_l4_v8(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Power Loss')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('Power Loss, kW')

  def TN_l4_v8_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.TN_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.TN_l4_v8(), dtype="object")

    plt.bar(index, np_array_of_objects)
    plt.xticks(index, xnames)
    plt.title('Power Loss')
    plt.xlabel('Bearing')
    plt.ylabel('Power Loss, kW')

  def TN_l6_v12(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.TN_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    self.sc.axes.bar(index, self.excel.TN_l6_v12())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Power Loss')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('Power Loss, kW')

  def TN_l6_v12_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.TN_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.TN_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    plt.bar(index, self.excel.TN_l6_v12())
    plt.xticks(index, xnames)

    plt.title('Power Loss')
    plt.xlabel('Bearing')
    plt.ylabel('Power Loss, kW')

  def hmin_base(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_base())):
      index.append(i)
    for i in range(len(self.excel.hmin_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_base(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_base_max(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_base_max())):
      index.append(i)
    for i in range(len(self.excel.hmin_base_max()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_base_max(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_base_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_base())):
      index.append(i)
    for i in range(len(self.excel.hmin_base()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_base(), dtype="object")

    ax = plt.gca()
    ax.bar(index, np_array_of_objects)
    ax.set_xticks(index, xnames)

    ax.set_title('Min. Oil Film Fickness')
    ax.set_xlabel('Bearing')
    ax.set_ylabel('MOFT, mm')

  def hmin_l4_v8(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.hmin_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_l4_v8(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_l4_v8_max(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l4_v8_max())):
      index.append(i)
    for i in range(len(self.excel.hmin_l4_v8_max()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_l4_v8_max(), dtype="object")

    self.sc.axes.bar(index, np_array_of_objects)
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_l4_v8_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l4_v8())):
      index.append(i)
    for i in range(len(self.excel.hmin_l4_v8()) - 1):
      xnames.append('M/N ' + str(i+1))

    np_array_of_objects = np.asarray(self.excel.hmin_l4_v8(), dtype="object")

    ax = plt.gca()
    ax.bar(index, np_array_of_objects)
    ax.set_xticks(index, xnames)

    ax.set_title('Min. Oil Film Fickness')
    ax.set_xlabel('Bearing')
    ax.set_ylabel('MOFT, mm')

  def hmin_l6_v12(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.hmin_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    self.sc.axes.bar(index, self.excel.hmin_l6_v12())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_l6_v12_max(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l6_v12_max())):
      index.append(i)
    for i in range(len(self.excel.hmin_l6_v12_max()) - 1):
      xnames.append('M/N ' + str(i+1))

    self.sc.axes.bar(index, self.excel.hmin_l6_v12_max())
    self.sc.axes.set_xticks(index, xnames)

    self.sc.axes.set_title('Min. Oil Film Fickness')
    self.sc.axes.set_xlabel('Bearing')
    self.sc.axes.set_ylabel('MOFT, mm')

  def hmin_l6_v12_for_save(self):
    index = []
    xnames = []
    xnames.append('B/E 1')

    for i in range(len(self.excel.hmin_l6_v12())):
      index.append(i)
    for i in range(len(self.excel.hmin_l6_v12()) - 1):
      xnames.append('M/N ' + str(i+1))

    ax = plt.gca()
    ax.bar(index, self.excel.hmin_l6_v12())
    ax.set_xticks(index, xnames)

    ax.set_title('Min. Oil Film Fickness')
    ax.set_xlabel('Bearing')
    ax.set_ylabel('MOFT, mm')

### END

  def FFT_bearing_graphic(self):
    # self.sc.axes.hist([x for x in range(len(self.excel.FFT_bearing()))], self.excel.FFT_bearing())
    # self.sc.axes.hist(self.excel.FFT_bearing(), [x for x in range(len(self.excel.FFT_bearing()))])
    # list_FFT_bearing = self.excel.FFT_bearing()
    # if (max(self.excel.FFT_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT_bearing()))], self.excel.FFT_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT_bearing()))
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT_bearing_graphic_for_save(self):
    # self.sc.axes.hist([x for x in range(len(self.excel.FFT_bearing()))], self.excel.FFT_bearing())
    # self.sc.axes.hist(self.excel.FFT_bearing(), [x for x in range(len(self.excel.FFT_bearing()))])
    list_FFT_bearing = self.excel.FFT_bearing()
    if (max(self.excel.FFT_bearing()) != 0):
      try:
         while True:
            list_FFT_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT_bearing()))
    plt.title('FFT - относительно неподвижного подшипника')

  def FFT1_bearing_graphic(self):
    # list_FFT1_bearing = self.excel.FFT1_bearing()
    # if (max(self.excel.FFT1_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT1_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT1_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT1_bearing()))], self.excel.FFT1_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT1_bearing()))
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT1_bearing_graphic_for_save(self):
    # self.sc.axes.hist([x for x in range(len(self.excel.FFT_bearing()))], self.excel.FFT_bearing())
    # self.sc.axes.hist(self.excel.FFT_bearing(), [x for x in range(len(self.excel.FFT_bearing()))])
    list_FFT1_bearing = self.excel.FFT1_bearing()
    if (max(self.excel.FFT1_bearing()) != 0):
      try:
         while True:
            list_FFT1_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT1_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT_bearing()))
    # self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    plt.title('FFT1 - относительно неподвижного подшипника')

  def FFT2_bearing_graphic(self):
    # list_FFT2_bearing = self.excel.FFT2_bearing()
    # if (max(self.excel.FFT2_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT2_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT2_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT2_bearing()))], self.excel.FFT2_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT2_bearing()))
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT2_bearing_graphic_for_save(self):
    list_FFT2_bearing = self.excel.FFT2_bearing()
    if (max(self.excel.FFT2_bearing()) != 0):
      try:
         while True:
            list_FFT2_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT2_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT2_bearing()))
    plt.title('FFT2 - относительно неподвижного подшипника')

  def FFT3_bearing_graphic(self):
    # list_FFT3_bearing = self.excel.FFT3_bearing()
    # if (max(self.excel.FFT3_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT3_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT3_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT3_bearing()))], self.excel.FFT3_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT3_bearing()))
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT3_bearing_graphic_for_save(self):
    list_FFT3_bearing = self.excel.FFT3_bearing()
    if (max(self.excel.FFT3_bearing()) != 0):
      try:
         while True:
            list_FFT3_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT3_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT3_bearing()))
    plt.title('FFT3 - относительно неподвижного подшипника')

  def FFT4_bearing_graphic(self):
    # list_FFT4_bearing = self.excel.FFT4_bearing()
    # if (max(self.excel.FFT4_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT4_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT4_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT4_bearing()))], self.excel.FFT4_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT4_bearing()))
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT4_bearing_graphic_for_save(self):
    list_FFT4_bearing = self.excel.FFT4_bearing()
    if (max(self.excel.FFT4_bearing()) != 0):
      try:
         while True:
            list_FFT4_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT4_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT4_bearing()))
    plt.title('FFT4 - относительно неподвижного подшипника')

  def FFT5_bearing_graphic(self):
    # list_FFT5_bearing = self.excel.FFT5_bearing()
    # if (max(self.excel.FFT5_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT5_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT5_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT5_bearing()))], self.excel.FFT5_bearing())
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT5_bearing()))
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT5_bearing_graphic_for_save(self):
    list_FFT5_bearing = self.excel.FFT5_bearing()
    if (max(self.excel.FFT5_bearing()) != 0):
      try:
         while True:
            list_FFT5_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT5_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT5_bearing()))
    plt.title('FFT5 - относительно неподвижного подшипника')

  def FFT6_bearing_graphic(self):
    # list_FFT6_bearing = self.excel.FFT6_bearing()
    # if (max(self.excel.FFT6_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT6_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT6_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT6_bearing()))], self.excel.FFT6_bearing())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT6_bearing()))
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT6_bearing_graphic_for_save(self):
    list_FFT6_bearing = self.excel.FFT6_bearing()
    if (max(self.excel.FFT6_bearing()) != 0):
      try:
         while True:
            list_FFT6_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT6_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT6_bearing()))
    plt.title('FFT6 - относительно неподвижного подшипника')

  def FFT7_bearing_graphic(self):
    # list_FFT7_bearing = self.excel.FFT7_bearing()
    # if (max(self.excel.FFT7_bearing()) != 0):
    #   try:
    #      while True:
    #         list_FFT7_bearing.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT7_bearing, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT7_bearing()))], self.excel.FFT7_bearing())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Bearing Angle')
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT7_bearing()))
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT7_bearing_graphic_for_save(self):
    list_FFT7_bearing = self.excel.FFT7_bearing()
    if (max(self.excel.FFT7_bearing()) != 0):
      try:
         while True:
            list_FFT7_bearing.remove(0)
      except:
         pass
    plt.hist(list_FFT7_bearing, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT7_bearing()))
    plt.title('FFT7 - относительно неподвижного подшипника')

  def FFT_shaft_graphic(self):
    # list_FFT_shaft = self.excel.FFT_shaft()
    # if (max(self.excel.FFT_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT_shaft()))], self.excel.FFT_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT_shaft()))
    self.sc.axes.set_title('FREQUENCY – INTENSITY')
  
  def FFT_graphic(self):

    self.sc.axes.plot(self.excel.FFT_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT1_graphic(self):

    self.sc.axes.plot(self.excel.FFT1_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT2_graphic(self):

    self.sc.axes.plot(self.excel.FFT2_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT3_graphic(self):

    self.sc.axes.plot(self.excel.FFT3_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT4_graphic(self):

    self.sc.axes.plot(self.excel.FFT4_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT5_graphic(self):

    self.sc.axes.plot(self.excel.FFT5_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT6_graphic(self):

    self.sc.axes.plot(self.excel.FFT6_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT7_graphic(self):

    self.sc.axes.plot(self.excel.FFT7_shaft(), 'r.')
    self.sc.axes.set_title('Oil Film Thickness vs Shaft Angle')

  def FFT_shaft_graphic_for_save(self):
    list_FFT_shaft = self.excel.FFT_shaft()
    if (max(self.excel.FFT_shaft()) != 0):
      try:
         while True:
            list_FFT_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT_shaft, bins=int(180))
    # self.sc.axes.set_xlim(xmin=1, xmax=max(self.excel.FFT_shaft()))
    plt.title('FFT - относительно неподвижного вала')

  def FFT1_shaft_graphic(self):
    # list_FFT1_shaft = self.excel.FFT1_shaft()
    # if (max(self.excel.FFT1_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT1_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT1_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT1_shaft()))], self.excel.FFT1_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT1_shaft_graphic_for_save(self):
    list_FFT1_shaft = self.excel.FFT1_shaft()
    if (max(self.excel.FFT1_shaft()) != 0):
      try:
         while True:
            list_FFT1_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT1_shaft, bins=int(180))
    plt.title('FFT1 - относительно неподвижного вала')

  def FFT2_shaft_graphic(self):
    # list_FFT2_shaft = self.excel.FFT2_shaft()
    # if (max(self.excel.FFT2_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT2_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT2_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT2_shaft()))], self.excel.FFT2_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT2_shaft_graphic_for_save(self):
    list_FFT2_shaft = self.excel.FFT2_shaft()
    if (max(self.excel.FFT2_shaft()) != 0):
      try:
         while True:
            list_FFT2_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT2_shaft, bins=int(180))
    plt.title('FFT2 - относительно неподвижного вала')

  def FFT3_shaft_graphic(self):
    # list_FFT3_shaft = self.excel.FFT3_shaft()
    # if (max(self.excel.FFT3_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT3_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT3_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT3_shaft()))], self.excel.FFT3_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT3_shaft_graphic_for_save(self):
    list_FFT3_shaft = self.excel.FFT3_shaft()
    if (max(self.excel.FFT3_shaft()) != 0):
      try:
         while True:
            list_FFT3_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT3_shaft, bins=int(180))
    plt.title('FFT3 - относительно неподвижного вала')

  def FFT4_shaft_graphic(self):
    # list_FFT4_shaft = self.excel.FFT4_shaft()
    # if (max(self.excel.FFT4_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT4_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT4_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT4_shaft()))], self.excel.FFT4_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT4_shaft_graphic_for_save(self):
    list_FFT4_shaft = self.excel.FFT4_shaft()
    if (max(self.excel.FFT4_shaft()) != 0):
      try:
         while True:
            list_FFT4_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT4_shaft, bins=int(180))
    plt.title('FFT4 - относительно неподвижного вала')

  def FFT5_shaft_graphic(self):
    # list_FFT5_shaft = self.excel.FFT5_shaft()
    # if (max(self.excel.FFT5_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT5_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT5_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT5_shaft()))], self.excel.FFT5_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT5_shaft_graphic_for_save(self):
    list_FFT5_shaft = self.excel.FFT5_shaft()
    if (max(self.excel.FFT5_shaft()) != 0):
      try:
         while True:
            list_FFT5_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT5_shaft, bins=int(180))
    plt.title('FFT5 - относительно неподвижного вала')

  def FFT6_shaft_graphic(self):
    # list_FFT6_shaft = self.excel.FFT6_shaft()
    # if (max(self.excel.FFT6_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT6_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT6_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT6_shaft()))], self.excel.FFT6_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT6_shaft_graphic_for_save(self):
    list_FFT6_shaft = self.excel.FFT6_shaft()
    if (max(self.excel.FFT6_shaft()) != 0):
      try:
         while True:
            list_FFT6_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT6_shaft, bins=int(180))
    plt.title('FFT6 - относительно неподвижного вала')

  def FFT7_shaft_graphic(self):
    # list_FFT7_shaft = self.excel.FFT7_shaft()
    # if (max(self.excel.FFT7_shaft()) != 0):
    #   try:
    #      while True:
    #         list_FFT7_shaft.remove(0)
    #   except:
    #      pass
    # self.sc.axes.hist(list_FFT7_shaft, bins=int(180))
    self.sc.axes.bar([i for i in range(len(self.excel.FFT7_shaft()))], self.excel.FFT7_shaft())
    self.sc.axes.set_ylabel("Relative Oil Film Thickness")
    self.sc.axes.set_xlabel('Shaft Angle')
    self.sc.axes.set_title('FREQUENCY – INTENSITY')

  def FFT7_shaft_graphic_for_save(self):
    list_FFT7_shaft = self.excel.FFT7_shaft()
    if (max(self.excel.FFT7_shaft()) != 0):
      try:
         while True:
            list_FFT7_shaft.remove(0)
      except:
         pass
    plt.hist(list_FFT7_shaft, bins=int(180))
    plt.title('FFT7 - относительно неподвижного вала')

  def draw_fourth_page_graphics(self):

    #Давление

    plt.subplot(2, 3, 1)
    self.PSUM_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 2)
    self.PSUM1_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 3)
    self.PSUM2_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 4)
    self.PSUM3_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 5)
    self.PSUM4_graphic()
    plt.tight_layout()

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

    plt.figure()
    
    #hmins

    plt.subplot(2, 3, 1)
    self.hmin_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 2)
    self.hmin1_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 3)
    self.hmin2_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 4)
    self.hmin3_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 5)
    self.hmin4_graphic()
    plt.tight_layout()

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

    plt.figure()
    #Траектории

    self.draw_cartesian_graphic(self.excel.xg(), self.excel.yg(),2, 5, 1, "yg-неподвижный подшипник")
    plt.tight_layout()
    self.draw_cartesian_graphic(self.excel.xq(), self.excel.yq(), 2, 5, 6, "yg-неподвижный вал")

    self.draw_cartesian_graphic(self.excel.xg1(), self.excel.yg1(), 2, 5, 2, "yg1-неподвижный подшипник")
    self.draw_cartesian_graphic(self.excel.xq1(), self.excel.yq1(), 2, 5, 7, "yg1 - неподвижный вал")

    self.draw_cartesian_graphic(self.excel.xg2(), self.excel.yg2(), 2, 5, 3, "yg2-неподвижный подшипник")
    self.draw_cartesian_graphic(self.excel.xq2(), self.excel.yq2(), 2, 5, 8, "yg2 - неподвижный вал")

    self.draw_cartesian_graphic(self.excel.xg3(), self.excel.yg3(), 2, 5, 4, "yg3-неподвижный подшипник")
    self.draw_cartesian_graphic(self.excel.xq3(), self.excel.yq3(), 2, 5, 9, "yg3 - неподвижный вал")

    self.draw_cartesian_graphic(self.excel.xg4(), self.excel.yg4(), 2, 5, 5, "yg4-неподвижный подшипник")
    self.draw_cartesian_graphic(self.excel.xq4(), self.excel.yq4(), 2, 5, 10,"yg4 - неподвижный вал")

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

    plt.figure()
    #ugm

    plt.subplot(2, 2, 1)
    self.ugm_graphic()
    plt.tight_layout()

    plt.subplot(2, 2, 2)
    self.ugw_graphic()
    plt.tight_layout()

    plt.subplot(2, 2, 3)
    self.ugm1_graphic()
    plt.tight_layout()

    plt.subplot(2, 2, 4)
    self.ugw1_graphic()
    plt.tight_layout()

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

    plt.figure()

    plt.subplot(2, 3, 1)
    self.ugm2_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 4)
    self.ugw2_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 2)
    self.ugm3_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 5)
    self.ugw3_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 3)
    self.ugm4_graphic()
    plt.tight_layout()

    plt.subplot(2, 3, 6)
    self.ugw4_graphic()
    plt.tight_layout()

    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

  def draw_first_page_graphics(self):
    self.first_page_graphics()
    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

  def draw_second_page_graphics(self):
    self.second_page_graphics()
    plt.get_current_fig_manager().window.showMaximized()
    plt.show()

  def save_first_page_graphic(self, path:str):
    old_path = os.getcwd()
    os.chdir(path)
    if os.path.isdir("Graphics"):
      shutil.rmtree("Graphics")
    os.mkdir("Graphics")
    os.chdir("Graphics")
    os.mkdir("1 Step")
    os.chdir("1 Step")
    self.first_page_graphics()
    plt.savefig("PIND.jpg")
    plt.close()
    os.chdir(old_path)

  def save_second_page_graphic(self, path:str):
    old_path = os.getcwd()
    os.chdir(path + '/Graphics')
    os.mkdir("2 Step")

    os.chdir("2 Step")
    
    self.FSUM_graphic_for_save()
    plt.savefig("FSUM.jpg")
    plt.close()

    self.beta_graphic_for_save()
    plt.savefig("beta.jpg")
    plt.close()

    self.GAM_graphic_for_save()
    plt.savefig("GAM.jpg")
    plt.close()

    self.FSUM_BETA_graphic()
    plt.savefig("FSUM_BETA.jpg")
    plt.close()

    self.FSUM_GAM_graphic()
    plt.savefig("FSUM_GAM.jpg")
    plt.close()

    os.chdir(old_path)

  def save_third_l3_v6_page_graphic(self, path:str):
    old_path = os.getcwd()
    os.chdir(path + '/Graphics')
    os.mkdir("3 Step")

    os.chdir("3 Step")

    self.FSUM1_graphic_for_save()
    plt.savefig("FSUM1.jpg")
    plt.close()

    self.FSUM2_graphic_for_save()
    plt.savefig("FSUM2.jpg")
    plt.close()

    self.FSUM3_graphic_for_save()
    plt.savefig("FSUM3.jpg")
    plt.close()

    self.BETA1_graphic_for_save()
    plt.savefig("BETA1.jpg")
    plt.close()

    self.BETA2_graphic_for_save()
    plt.savefig("BETA2.jpg")
    plt.close()

    self.BETA3_graphic_for_save()
    plt.savefig("BETA3.jpg")
    plt.close()

    self.GAM1_graphic_for_save()
    plt.savefig("GAM1.jpg")
    plt.close()

    self.GAM2_graphic_for_save()
    plt.savefig("GAM2.jpg")
    plt.close()

    self.GAM3_graphic_for_save()
    plt.savefig("GAM3.jpg")
    plt.close()

    self.FSUM1_BETA1_graphic()
    plt.savefig("FSUM1_BETA1.jpg")
    plt.close()

    self.FSUM2_BETA2_graphic()
    plt.savefig('FSUM2_BETA2.jpg')
    plt.close()

    self.FSUM3_BETA3_graphic()
    plt.savefig('FSUM3_BETA3.jpg')
    plt.close()

    self.FSUM4_BETA4_graphic()
    plt.savefig('FSUM4_BETA4.jpg')
    plt.close()

    self.FSUM1_GAM1_graphic()
    plt.savefig('FSUM1_GAM1.jpg')
    plt.close()

    self.FSUM2_GAM2_graphic()
    plt.savefig('FSUM2_GAM2.jpg')
    plt.close()

    self.FSUM3_GAM3_graphic()
    plt.savefig('FSUM3_GAM3.jpg')
    plt.close()

    self.FSUM4_GAM4_graphic()
    plt.savefig('FSUM4_GAM4.jpg')
    plt.close()

    os.chdir(old_path)

  def save_fourth_l3_v6_page_graphic(self, path:str):
    old_path = os.getcwd()
    os.chdir(path + '/Graphics')
    os.mkdir("4 Step")

    os.chdir("4 Step")

    self.PSUM1_graphic_for_save()
    plt.savefig("PSUM1.jpg")
    plt.close()

    self.PSUM2_graphic_for_save()
    plt.savefig("PSUM2.jpg")
    plt.close()

    self.PSUM3_graphic_for_save()
    plt.savefig("PSUM3.jpg")
    plt.close()

    self.PSUM4_graphic_for_save()
    plt.savefig("PSUM4.jpg")
    plt.close()

    self.hmin_graphic_for_save()
    plt.savefig("hmin.jpg")
    plt.close()

    self.hmin1_graphic_for_save()
    plt.savefig("hmin1.jpg")
    plt.close()

    self.hmin2_graphic_for_save()
    plt.savefig("hmin2.jpg")
    plt.close()

    self.hmin3_graphic_for_save()
    plt.savefig("hmin3.jpg")
    plt.close()

    self.hmin4_graphic_for_save()
    plt.savefig("hmin4.jpg")
    plt.close()

    self.yg_bearing_graphic_for_save()
    plt.savefig("yg_bearing.jpg")
    plt.close()

    self.yg_shaft_graphic_for_save()
    plt.savefig("yg_shaft.jpg")
    plt.close()

    self.yg1_bearing_graphic_for_save()
    plt.savefig("yg1_bearing.jpg")
    plt.close()

    self.yg1_shaft_graphic_for_save()
    plt.savefig("yg1_shaft.jpg")
    plt.close()

    self.yg2_bearing_graphic_for_save()
    plt.savefig("yg2_bearing.jpg")
    plt.close()

    self.yg2_shaft_graphic_for_save()
    plt.savefig("yg2_shaft.jpg")
    plt.close()

    self.yg3_bearing_graphic_for_save()
    plt.savefig("yg3_bearing.jpg")
    plt.close()

    self.yg3_shaft_graphic_for_save()
    plt.savefig("yg3_shaft.jpg")
    plt.close()

    self.yg4_bearing_graphic_for_save()
    plt.savefig("yg4_bearing.jpg")
    plt.close()

    self.yg4_shaft_graphic_for_save()
    plt.savefig("yg4_shaft.jpg")
    plt.close()

    self.ugm_graphic_for_save()
    plt.savefig("ugm.jpg")
    plt.close()

    self.ugw_graphic_for_save()
    plt.savefig("ugw.jpg")
    plt.close()

    self.ugm1_graphic_for_save()
    plt.savefig("ugm1.jpg")
    plt.close()

    self.ugw1_graphic_for_save()
    plt.savefig("ugw1.jpg")
    plt.close()

    self.ugm2_graphic_for_save()
    plt.savefig("ugm2.jpg")
    plt.close()

    self.ugw2_graphic_for_save()
    plt.savefig("ugw3.jpg")
    plt.close()

    self.ugm3_graphic_for_save()
    plt.savefig("ugm3.jpg")
    plt.close()

    self.ugw3_graphic_for_save()
    plt.savefig("ugw3.jpg")
    plt.close()

    self.ugm4_graphic_for_save()
    plt.savefig("ugm4.jpg")
    plt.close()

    self.ugw4_graphic_for_save()
    plt.savefig("ugw4.jpg") 
    plt.close()

    self.dm_ugm_cartesian_graphic_for_save()
    plt.savefig("dm_ugm_cartesian.jpg")
    plt.close()

    self.dm_ugw_cartesian_graphic_for_save()
    plt.savefig("dm_ugw_cartesian.jpg")
    plt.close()

    self.dm1_ugm1_cartesian_graphic_for_save()
    plt.savefig("dm1_ugm1_cartesian.jpg")
    plt.close()

    self.dm1_ugw1_cartesian_graphic_for_save()
    plt.savefig("dm1_ugw1_cartesian.jpg")
    plt.close()

    self.dm2_ugm2_cartesian_graphic_for_save()
    plt.savefig("dm2_ugm2_cartesian.jpg")
    plt.close()

    self.dm2_ugw2_cartesian_graphic_for_save()
    plt.savefig("dm2_ugw2_cartesian.jpg")
    plt.close()

    self.dm3_ugm3_cartesian_graphic_for_save()
    plt.savefig("dm3_ugm3_cartesian.jpg")
    plt.close()

    self.dm3_ugw3_cartesian_graphic_for_save()
    plt.savefig("dm3_ugw3_cartesian.jpg")
    plt.close()

    self.dm4_ugm4_cartesian_graphic_for_save()
    plt.savefig("dm4_ugm4_cartesian.jpg")
    plt.close()

    self.dm4_ugw4_cartesian_graphic_for_save()
    plt.savefig("dm4_ugw4_cartesian.jpg")
    plt.close()

    self.dm_ugm_for_save()
    plt.savefig("dm_ugm_polar.jpg")
    plt.close()

    self.dm_ugw_for_save()
    plt.savefig("dm_ugw_polar.jpg")
    plt.close()

    self.dm1_ugm1_for_save()
    plt.savefig("dm1_ugm1_polar.jpg")
    plt.close()

    self.dm1_ugw1_for_save()
    plt.savefig("dm1_ugw1_polar.jpg")
    plt.close()

    self.dm2_ugm2_for_save()
    plt.savefig("dm2_ugm2_polar.jpg")
    plt.close()

    self.dm2_ugw2_for_save()
    plt.savefig("dm2_ugw2_polar.jpg")
    plt.close()

    self.dm3_ugm3_for_save()
    plt.savefig("dm3_ugm3_polar.jpg")
    plt.close()

    self.dm3_ugw3_for_save()
    plt.savefig("dm3_ugw3_polar.jpg")
    plt.close()

    self.dm4_ugm4_for_save()
    plt.savefig("dm4_ugm4_polar.jpg")
    plt.close()

    self.dm4_ugw4_for_save()
    plt.savefig("dm4_ugw4_polar.jpg")
    plt.close()

    if self.expert.engine_type == 'L3' or self.expert.engine_type == 'V6':

      self.FMAX_base_for_save()
      plt.savefig("Specific load.jpg")
      plt.close()

      self.hmin_base_for_save()
      plt.savefig("Min oil film thickness.jpg")
      plt.close()

      self.dm_base_for_save()
      plt.savefig("Суммарная диаграмма максимального давления.jpg")
      plt.close()

    os.chdir(old_path)

  def save_fifth_l3_v6_page_graphic(self, path:str):
    old_path = os.getcwd()
    os.chdir(path + '/Graphics')
    os.mkdir("5 Step")

    os.chdir("5 Step")

    self.TN_graphic_for_save()
    plt.savefig("TN.jpg")
    plt.close()

    self.TN1_graphic_for_save()
    plt.savefig("TN1.jpg")
    plt.close()

    self.TN2_graphic_for_save()
    plt.savefig("TN2.jpg")
    plt.close()

    self.TN3_graphic_for_save()
    plt.savefig("TN3.jpg")
    plt.close()

    self.TN4_graphic_for_save()
    plt.savefig("TN4.jpg")
    plt.close()

    self.FFT_bearing_graphic_for_save()
    plt.savefig("FFT_bearing.jpg")
    plt.close()

    self.FFT1_bearing_graphic_for_save()
    plt.savefig("FFT1_bearing.jpg")
    plt.close()

    self.FFT2_bearing_graphic_for_save()
    plt.savefig("FFT2_bearing.jpg")
    plt.close()

    self.FFT3_bearing_graphic_for_save()
    plt.savefig("FFT3_bearing.jpg")
    plt.close()

    self.FFT4_bearing_graphic_for_save()
    plt.savefig("FFT4_bearing.jpg")
    plt.close()

    self.FFT_shaft_graphic_for_save()
    plt.savefig("FFT_shaft.jpg")
    plt.close()

    self.FFT1_shaft_graphic_for_save()
    plt.savefig("FFT1_shaft.jpg")
    plt.close()

    self.FFT2_shaft_graphic_for_save()
    plt.savefig("FFT2_shaft.jpg")
    plt.close()

    self.FFT3_shaft_graphic_for_save()
    plt.savefig("FFT3_shaft.jpg")
    plt.close()

    self.FFT4_shaft_graphic_for_save()
    plt.savefig("FFT4_shaft.jpg")
    plt.close()

    if self.expert.engine_type == 'L3' or self.expert.engine_type == 'V6':

      self.TN_base_for_save()
      plt.savefig("Суммарная диаграмма потерь на трение.jpg")
      plt.close()

    os.chdir(old_path)

  def save_third_l4_v8_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_third_l3_v6_page_graphic(path)
    os.chdir(path + '/Graphics/3 Step')

    self.FSUM5_BETA5_graphic()
    plt.savefig('FSUM5_BETA5.jpg')
    plt.close()

    self.FSUM5_GAM5_graphic()
    plt.savefig('FSUM5_GAM5.jpg')
    plt.close()

    os.chdir(old_path)

  def save_third_l6_v12_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_third_l4_v8_page_graphic(path)
    os.chdir(path + '/Graphics/3 Step')


    self.FSUM6_BETA6_graphic()
    plt.savefig('FSUM6_BETA6.jpg')
    plt.close()

    self.FSUM6_GAM6_graphic()
    plt.savefig('FSUM6_GAM6.jpg')
    plt.close()

    self.FSUM7_BETA7_graphic()
    plt.savefig('FSUM7_BETA7.jpg')
    plt.close()

    self.FSUM7_GAM7_graphic()
    plt.savefig('FSUM7_GAM7.jpg')
    plt.close()

    os.chdir(old_path)

  def save_fourth_l4_v8_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_fourth_l3_v6_page_graphic(path)
    os.chdir(path + '/Graphics/4 Step')
    
    self.PSUM5_graphic_for_save()
    plt.savefig('FSUM5.jpg')
    plt.close()

    self.hmin5_graphic_for_save()
    plt.savefig('hmin5.jpg')
    plt.close()

    self.yg5_bearing_graphic_for_save()
    plt.savefig('yg5_bearing.jpg')
    plt.close()

    self.yg5_shaft_graphic_for_save()
    plt.savefig('yg5_shaft.jpg')
    plt.close()

    self.ugm5_graphic_for_save()
    plt.savefig("ugm5.jpg")
    plt.close()

    self.ugw5_graphic_for_save()
    plt.savefig("ugw5.jpg")
    plt.close()

    self.dm5_ugm5_cartesian_graphic_for_save()
    plt.savefig("dm5_ugm5_cartesian.jpg")
    plt.close()

    self.dm5_ugw5_cartesian_graphic_for_save()
    plt.savefig("dm5_ugw5_cartesian.jpg")
    plt.close()

    self.dm5_ugm5_for_save()
    plt.savefig("dm5_ugm5_polar.jpg")
    plt.close()

    self.dm5_ugw5_for_save()
    plt.savefig("dm5_ugw5_polar.jpg")
    plt.close()

    if self.expert.engine_type == 'L4' or self.expert.engine_type == 'V8':
      
      self.FMAX_l4_v8_for_save()
      plt.savefig("Specific load.jpg")
      plt.close()

      self.hmin_l4_v8_for_save()
      plt.savefig("Min oil film thickness.jpg")
      plt.close()

      self.dm_l4_v8_for_Save()
      plt.savefig("Суммарная диаграмма максимального давления.jpg")
      plt.close()

    os.chdir(old_path)

  def save_fifth_l4_v8_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_fifth_l3_v6_page_graphic(path)
    os.chdir(path + '/Graphics/5 Step')
    
    self.TN5_graphic_for_save()
    plt.savefig('TN5.jpg')
    plt.close()

    self.FFT5_bearing_graphic_for_save()
    plt.savefig('FTT5_bearing.jpg')
    plt.close()

    self.FFT5_shaft_graphic_for_save()
    plt.savefig('FTT5_shaft.jpg')
    plt.close()

    if self.expert.engine_type == 'L4' or self.expert.engine_type == 'V8':
      
      self.TN_l4_v8_for_save()
      plt.savefig("Суммарная диаграмма потерь на трение.jpg")
      plt.close()

    os.chdir(old_path)

  def save_fourth_l6_v12_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_fourth_l4_v8_page_graphic(path)
    os.chdir(path + '/Graphics/4 Step')
    
    self.PSUM6_graphic_for_save()
    plt.savefig('FSUM6.jpg')
    plt.close()

    self.PSUM7_graphic_for_save()
    plt.savefig('FSUM7.jpg')
    plt.close()

    self.hmin6_graphic_for_save()
    plt.savefig('hmin6.jpg')
    plt.close()

    self.hmin7_graphic_for_save()
    plt.savefig('hmin7.jpg')
    plt.close()

    self.yg6_bearing_graphic_for_save()
    plt.savefig('yg6_bearing.jpg')
    plt.close()

    self.yg7_bearing_graphic_for_save()
    plt.savefig('yg7_bearing.jpg')
    plt.close()

    self.yg6_shaft_graphic_for_save()
    plt.savefig('yg6_shaft.jpg')
    plt.close()

    self.yg7_shaft_graphic_for_save()
    plt.savefig('yg7_shaft.jpg')
    plt.close()

    self.ugm6_graphic_for_save()
    plt.savefig("ugm6.jpg")
    plt.close()

    self.ugm7_graphic_for_save()
    plt.savefig("ugm7.jpg")
    plt.close()

    self.ugw6_graphic_for_save()
    plt.savefig("ugw6.jpg")
    plt.close()

    self.ugw7_graphic_for_save()
    plt.savefig("ugw7.jpg")
    plt.close()

    self.dm6_ugm6_cartesian_graphic_for_save()
    plt.savefig("dm6_ugm6_cartesian.jpg")
    plt.close()

    self.dm6_ugw6_cartesian_graphic_for_save()
    plt.savefig("dm6_ugw6_cartesian.jpg")
    plt.close()

    self.dm7_ugm7_cartesian_graphic_for_save()
    plt.savefig("dm7_ugm7_cartesian.jpg")
    plt.close()

    self.dm7_ugw7_cartesian_graphic_for_save()
    plt.savefig("dm7_ugw7_cartesian.jpg")
    plt.close()

    self.dm6_ugm6_for_save()
    plt.savefig("dm6_ugm6_polar.jpg")
    plt.close()

    self.dm6_ugw6_for_save()
    plt.savefig("dm6_ugw6_polar.jpg")
    plt.close()

    self.dm7_ugm7_for_save()
    plt.savefig("dm7_ugm7_polar.jpg")
    plt.close()

    self.dm7_ugw7_for_save()
    plt.savefig("dm7_ugw7_polar.jpg")
    plt.close()

    self.FMAX_l6_v12_for_save()
    plt.savefig("Specific load.jpg")
    plt.close()

    self.hmin_l6_v12_for_save()
    plt.savefig("Min oil film thickness.jpg")
    plt.close()

    self.dm_l6_v12_for_save()
    plt.savefig("Суммарная диаграмма максимального давления.jpg")
    plt.close()

    os.chdir(old_path)

  def save_fifth_l6_v12_page_graphic(self, path:str):
    old_path = os.getcwd()
    self.save_fifth_l4_v8_page_graphic(path)
    os.chdir(path + '/Graphics/5 Step')
    
    self.TN6_graphic_for_save()
    plt.savefig('TN6.jpg')
    plt.close()

    self.TN7_graphic_for_save()
    plt.savefig('TN7.jpg')
    plt.close()

    self.FFT6_bearing_graphic_for_save()
    plt.savefig('FFT6_bearing.jpg')
    plt.close()

    self.FFT7_bearing_graphic_for_save()
    plt.savefig('FFT7_bearing.jpg')
    plt.close()

    self.FFT6_shaft_graphic_for_save()
    plt.savefig('FFT6_shaft.jpg')
    plt.close()

    self.FFT7_shaft_graphic_for_save()
    plt.savefig('FFT7_shaft.jpg')
    plt.close()

    self.TN_l6_v12_for_save()
    plt.savefig("Суммарная диаграмма потерь на трение.jpg")
    plt.close()

    os.chdir(old_path)

  def save_l3_v6_graphics(self, path):
     self.save_first_page_graphic(path)
     self.save_second_page_graphic(path)
     self.save_third_l3_v6_page_graphic(path)
     self.save_fourth_l3_v6_page_graphic(path)
     self.save_fifth_l3_v6_page_graphic(path)

  def save_l4_v8_graphics(self, path):
    self.save_first_page_graphic(path)
    self.save_second_page_graphic(path)
    self.save_third_l4_v8_page_graphic(path)
    self.save_fourth_l4_v8_page_graphic(path)
    self.save_fifth_l4_v8_page_graphic(path)

  def save_l6_v12_graphics(self, path):
     self.save_first_page_graphic(path)
     self.save_second_page_graphic(path)
     self.save_third_l6_v12_page_graphic(path)
     self.save_fourth_l6_v12_page_graphic(path)
     self.save_fifth_l6_v12_page_graphic(path)

  def rm_first_page(self, path):
      old_path = os.getcwd()
      os.chdir(path)
      shutil.rmtree("Graphics")
      os.chdir(old_path)
    
  def rm_second_page(self, path):
      old_path = os.getcwd()
      os.chdir(path + '/Graphics')
      shutil.rmtree('2 Step')
      os.chdir(old_path)

  def rm_third_page(self, path):
      old_path = os.getcwd()
      os.chdir(path + '/Graphics')
      shutil.rmtree('3 Step')
      os.chdir(old_path)

  def rm_fourth_page(self, path):
      old_path = os.getcwd()
      os.chdir(path + '/Graphics')
      shutil.rmtree('4 Step')
      os.chdir(old_path)

            # app = QApplication(sys.argv)
            # grap = Graphics("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # countPage = MainWindow()

            # FSUM = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # PIND = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # beta = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # GAM = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # FSUM_BETA = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # FSUM1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # FSUM2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # FSUM3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # BETA1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
            # BETA2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# BETA3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# # GAM = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# GAM1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# GAM2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# GAM3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM1_BETA1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM2_BETA2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM3_BETA3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM1_GAM1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM2_GAM2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# FSUM3_GAM3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# PSUM = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# PSUM1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# PSUM2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# PSUM3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# PSUM4 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# hmin = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# hmin1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# hmin2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# hmin3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# hmin4 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg_bearing = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg_shaft = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg1_bearing = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg1_shaft = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg2_bearing = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg2_shaft = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg3_bearing = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg3_shaft = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg4_bearing = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# yg4_shaft = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugm = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugw = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugm1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugw1 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugm2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugw2 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugm3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugw3 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugm4 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")
# ugw4 = MainWidget("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")


# grapAndTable.add_tab("PIND", PIND)
# grapAndTable.add_tab("FSUM", FSUM)
# grapAndTable.add_tab("beta", beta)
# grapAndTable.add_tab("GAM", GAM)
# grapAndTable.add_tab("FSUM_BETA", FSUM_BETA)
# grapAndTable.add_tab("FSUM1", FSUM1)
# grapAndTable.add_tab("FSUM2", FSUM2)
# grapAndTable.add_tab("FSUM3", FSUM3)
# grapAndTable.add_tab("BETA1", BETA1)
# grapAndTable.add_tab("BETA2", BETA2)
# grapAndTable.add_tab("BETA3", BETA3)
# # grapAndTable.add_tab("GAM", GAM)
# grapAndTable.add_tab("GAM1", GAM1)
# grapAndTable.add_tab("GAM2", GAM2)
# grapAndTable.add_tab("GAM3", GAM3)
# grapAndTable.add_tab("FSUM1_BETA1", FSUM1_BETA1)
# grapAndTable.add_tab("FSUM2_BETA2", FSUM2_BETA2)
# grapAndTable.add_tab("FSUM3_BETA3", FSUM3_BETA3)
# grapAndTable.add_tab("FSUM1_GAM1", FSUM1_GAM1)
# grapAndTable.add_tab("FSUM2_GAM2", FSUM2_GAM2)
# grapAndTable.add_tab("FSUM3_GAM3", FSUM3_GAM3)
# grapAndTable.add_tab("PSUM", PSUM)
# grapAndTable.add_tab("PSUM1", PSUM1)
# grapAndTable.add_tab("PSUM2", PSUM2)
# grapAndTable.add_tab("PSUM3", PSUM3)
# grapAndTable.add_tab("PSUM4", PSUM4)
# grapAndTable.add_tab("hmin", hmin)
# grapAndTable.add_tab("hmin1", hmin1)
# grapAndTable.add_tab("hmin2", hmin2)
# grapAndTable.add_tab("hmin3", hmin3)
# grapAndTable.add_tab("hmin4", hmin4)
# grapAndTable.add_tab("yg-bearing", yg_bearing)
# grapAndTable.add_tab("yg-shaft", yg_shaft)
# grapAndTable.add_tab("yg1-bearing", yg1_bearing)
# grapAndTable.add_tab("yg1-shaft", yg1_shaft)
# grapAndTable.add_tab("yg2-bearing", yg2_bearing)
# grapAndTable.add_tab("yg2-shaft", yg2_shaft)
# grapAndTable.add_tab("yg3-bearing", yg3_bearing)
# grapAndTable.add_tab("yg3-shaft", yg3_shaft)
# grapAndTable.add_tab("yg4-bearing", yg4_bearing)
# grapAndTable.add_tab("yg4-shaft", yg4_shaft)
# grapAndTable.add_tab("ugm", ugm)
# grapAndTable.add_tab("ugw", ugw)
# grapAndTable.add_tab("ugm1", ugm1)
# grapAndTable.add_tab("ugw1", ugw1)
# grapAndTable.add_tab("ugm2", ugm2)
# grapAndTable.add_tab("ugw2", ugw2)
# grapAndTable.add_tab("ugm3", ugm3)
# grapAndTable.add_tab("ugw3", ugw3)
# grapAndTable.add_tab("ugm4", ugm4)
# grapAndTable.add_tab("ugw4", ugw4)

# PIND.graphic.PIND_graphic()
# FSUM.graphic.FSUM_graphic()
# beta.graphic.beta_graphic()
# GAM.graphic.GAM_graphic()
# FSUM_BETA.graphic.FSUM_BETA_graphic()
# FSUM1.graphic.FSUM1_graphic()
# FSUM2.graphic.FSUM2_graphic()
# FSUM3.graphic.FSUM3_graphic()
# BETA1.graphic.BETA1_graphic()
# BETA2.graphic.BETA2_graphic()
# BETA3.graphic.BETA3_graphic()
# # GAM.graphic.GAM_graphic()
# GAM1.graphic.GAM1_graphic()
# GAM2.graphic.GAM2_graphic()
# GAM3.graphic.GAM3_graphic()
# FSUM1_BETA1.graphic.FSUM1_BETA1_graphic()
# FSUM2_BETA2.graphic.FSUM2_BETA2_graphic()
# FSUM3_BETA3.graphic.FSUM3_BETA3_graphic()
# FSUM1_GAM1.graphic.FSUM1_GAM1_graphic()
# FSUM2_GAM2.graphic.FSUM2_GAM2_graphic()
# FSUM3_GAM3.graphic.FSUM3_GAM3_graphic()
# PSUM.graphic.PSUM_graphic()
# PSUM1.graphic.PSUM1_graphic()
# PSUM2.graphic.PSUM2_graphic()
# PSUM3.graphic.PSUM3_graphic()
# PSUM4.graphic.PSUM4_graphic()
# hmin.graphic.hmin_graphic()
# hmin1.graphic.hmin1_graphic()
# hmin2.graphic.hmin2_graphic()
# hmin3.graphic.hmin3_graphic()
# hmin4.graphic.hmin4_graphic()
# yg_bearing.graphic.yg_bearing_graphic()
# yg_shaft.graphic.yg_shaft_graphic()
# yg1_bearing.graphic.yg1_bearing_graphic()
# yg1_shaft.graphic.yg1_shaft_graphic()
# yg2_bearing.graphic.yg2_bearing_graphic()
# yg2_shaft.graphic.yg2_shaft_graphic()
# yg3_bearing.graphic.yg3_bearing_graphic()
# yg3_shaft.graphic.yg3_shaft_graphic()
# yg4_bearing.graphic.yg4_bearing_graphic()
# yg4_shaft.graphic.yg4_shaft_graphic()
# ugm.graphic.ugm_graphic()
# ugw.graphic.ugw_graphic()
# ugm1.graphic.ugm1_graphic()
# ugw1.graphic.ugw1_graphic()
# ugm2.graphic.ugm2_graphic()
# ugw2.graphic.ugw2_graphic()
# ugm3.graphic.ugm3_graphic()
# ugw3.graphic.ugw3_graphic()
# ugm4.graphic.ugm4_graphic()
# ugw4.graphic.ugw4_graphic()

# PIND.table.new_tab(
#     "PIND",
#     {
#         "PIND": PIND.table.readExcel.getPIND()
#     },
# )
# FSUM.table.new_tab(
#     "FSUM",
#     {
#         "FSUM": FSUM.table.readExcel.getFSUM()
#     },
# )
# beta.table.new_tab(
#     "beta",
#     {
#         "beta": beta.table.readExcel.getBETA()
#     }
# )
# GAM.table.new_tab(
#     "GAM",
#     {
#         "GAM": GAM.table.readExcel.getGAM()
#     }
# )
# FSUM_BETA.table.new_tab(
#     "FSUM_BETA",
#     {
#         "FSUM": FSUM_BETA.table.readExcel.getFSUM(),
#         "BETA": FSUM_BETA.table.readExcel.getBETA()
#     }
# )
# FSUM1.table.new_tab(
#     "FSUM1",
#     {
#         "FSUM1": FSUM1.table.readExcel.getFSUM1()
#     }
# )
# FSUM2.table.new_tab(
#     "FSUM2",
#     {
#         "FSUM2": FSUM2.table.readExcel.getFSUM2()
#     }
# )
# FSUM3.table.new_tab(
#     "FSUM3",
#     {
#         "FSUM3": FSUM3.table.readExcel.getFSUM3()
#     }
# )
# BETA1.table.new_tab(
#     "BETA1",
#     {
#         "BETA1": FSUM3.table.readExcel.getBETA1()
#     }
# )
# BETA2.table.new_tab(
#     "BETA2",
#     {
#         "FSUM3": FSUM3.table.readExcel.getBETA2()
#     }
# )
# BETA3.table.new_tab(
#     "BETA3",
#     {
#         "BETA3": FSUM3.table.readExcel.getBETA3()
#     }
# )
# GAM1.table.new_tab(
#     "GAM1",
#     {
#         "GAM1": GAM1.table.readExcel.getGAM1()
#     }
# )
# GAM2.table.new_tab(
#     "GAM2",
#     {
#         "GAM2": GAM2.table.readExcel.getGAM2()
#     }
# )
# GAM3.table.new_tab(
#     "GAM3",
#     {
#         "GAM3": GAM3.table.readExcel.getGAM3()
#     }
# )
# FSUM1_BETA1.table.new_tab(
#     "FSUM1_BETA1",
#     {
#         "FSUM1": FSUM1.table.readExcel.getFSUM1(),
#         "BETA1": BETA1.table.readExcel.getBETA1()    
#     },
# )
# FSUM2_BETA2.table.new_tab(
#     "FSUM2_BETA2",
#     {
#         "FSUM2": FSUM1.table.readExcel.getFSUM2(),
#         "BETA2": BETA1.table.readExcel.getBETA2()    
#     },
# )
# FSUM3_BETA3.table.new_tab(
#     "FSUM3_BETA3",
#     {
#         "FSUM3": FSUM1.table.readExcel.getFSUM1(),
#         "BETA3": BETA1.table.readExcel.getBETA1()    
#     },
# )
# FSUM1_GAM1.table.new_tab(
#     "FSUM1_GAM1",
#     {
#         "FSUM1": FSUM1.table.readExcel.getFSUM1(),
#         "GAM1": GAM1.table.readExcel.getGAM1()
#     }
# )
# FSUM2_GAM2.table.new_tab(
#     "FSUM2_GAM2",
#     {
#         "FSUM2": FSUM1.table.readExcel.getFSUM2(),
#         "GAM2": GAM1.table.readExcel.getGAM2()
#     }
# )
# FSUM3_GAM3.table.new_tab(
#     "FSUM3_GAM3",
#     {
#         "FSUM3": FSUM3.table.readExcel.getFSUM3(),
#         "GAM3": GAM3.table.readExcel.getGAM3()
#     }
# )
# PSUM.table.new_tab(
#     "PSUM",
#     {
#         "PSUM": PSUM.table.readExcel.PSUM()
#     }
# )
# PSUM1.table.new_tab(
#     "PSUM1",
#     {
#         "PSUM1": PSUM1.table.readExcel.PSUM1()
#     }
# )
# PSUM2.table.new_tab(
#     "PSUM2",
#     {
#         "PSUM2": PSUM1.table.readExcel.PSUM2()
#     }
# )
# PSUM3.table.new_tab(
#     "PSUM3",
#     {
#         "PSUM3": PSUM1.table.readExcel.PSUM3()
#     }
# )
# PSUM4.table.new_tab(
#     "PSUM4",
#     {
#         "PSUM4": PSUM1.table.readExcel.PSUM4()
#     }
# )
# hmin.table.new_tab(
#     "hmin",
#     {
#         "hmin": hmin.table.readExcel.hmin()
#     }
# )
# hmin1.table.new_tab(
#     "hmin1",
#     {
#         "hmin1": hmin1.table.readExcel.hmin1()
#     }
# )
# hmin2.table.new_tab(
#     "hmin2",
#     {
#         "hmin2": hmin2.table.readExcel.hmin2()
#     }
# )
# hmin3.table.new_tab(
#     "hmin3",
#     {
#         "hmin3": hmin3.table.readExcel.hmin3()
#     }
# )
# hmin4.table.new_tab(
#     "hmin4",
#     {
#         "hmin4": hmin4.table.readExcel.hmin4()
#     }
# )
# yg_bearing.table.new_tab(
#     "yg_bearing",
#     {
#         "xg": yg_bearing.table.readExcel.xg(),
#         "yg": yg_bearing.table.readExcel.yg()
#     }
# )
# yg_shaft.table.new_tab(
#     "yg_shaft",
#     {
#         "xq": yg_shaft.table.readExcel.xq(),
#         "yq": yg_shaft.table.readExcel.yq()
#     }
# )
# yg1_bearing.table.new_tab(
#     "yg1_bearing",
#     {
#         "xg1": yg1_bearing.table.readExcel.xg1(),
#         "yg1": yg1_bearing.table.readExcel.yg1()
#     }
# )
# yg1_shaft.table.new_tab(
#     "yg1_shaft",
#     {
#         "xq1": yg1_shaft.table.readExcel.xq1(),
#         "yq1": yg1_shaft.table.readExcel.yq1()
#     }
# )
# yg2_bearing.table.new_tab(
#     "yg2_bearing",
#     {
#         "xg2": yg2_bearing.table.readExcel.xg2(),
#         "yg2": yg2_bearing.table.readExcel.yg2()
#     }
# )
# yg2_shaft.table.new_tab(
#     "yg2_shaft",
#     {
#         "xq2": yg2_shaft.table.readExcel.xq2(),
#         "yq2": yg2_shaft.table.readExcel.yq2()
#     }
# )
# yg3_bearing.table.new_tab(
#     "yg3_bearing",
#     {
#         "xg3": yg3_bearing.table.readExcel.xg3(),
#         "yg3": yg3_bearing.table.readExcel.yg3()
#     }
# )
# yg3_shaft.table.new_tab(
#     "yg3_shaft",
#     {
#         "xq3": yg3_shaft.table.readExcel.xq3(),
#         "yq3": yg3_shaft.table.readExcel.yq3()
#     }
# )
# yg4_bearing.table.new_tab(
#     "yg4_bearing",
#     {
#         "xg4": yg4_bearing.table.readExcel.xg4(),
#         "yg4": yg4_bearing.table.readExcel.yg4()
#     }
# )
# yg4_shaft.table.new_tab(
#     "yg4_shaft",
#     {
#         "xq4": yg4_shaft.table.readExcel.xq4(),
#         "yq4": yg4_shaft.table.readExcel.yq4()
#     }
# )
# ugm.table.new_tab(
#     "ugm",
#     {
#         "ugm": ugm.table.readExcel.ugm(),
#     }
# )
# ugw.table.new_tab(
#     "ugw",
#     {
#         "ugw": ugw.table.readExcel.ugw()
#     }
# )
# ugm1.table.new_tab(
#     "ugm1",
#     {
#         "ugm1": ugm1.table.readExcel.ugm1(),
#     }
# )
# ugw1.table.new_tab(
#     "ugw1",
#     {
#         "ugw1": ugw1.table.readExcel.ugw1()
#     }
# )
# ugm2.table.new_tab(
#     "ugm2",
#     {
#         "ugm2": ugm2.table.readExcel.ugm2(),
#     }
# )
# ugw2.table.new_tab(
#     "ugw2",
#     {
#         "ugw2": ugw2.table.readExcel.ugw2()
#     }
# )
# ugm3.table.new_tab(
#     "ugm3",
#     {
#         "ugm3": ugm3.table.readExcel.ugm3(),
#     }
# )
# ugw3.table.new_tab(
#     "ugw3",
#     {
#         "ugw3": ugw3.table.readExcel.ugw3()
#     }
# )
# ugm4.table.new_tab(
#     "ugm4",
#     {
#         "ugm4": ugm4.table.readExcel.ugm4(),
#     }
# )
# ugw4.table.new_tab(
#     "ugw4",
#     {
#         "ugw4": ugw4.table.readExcel.ugw4()
#     }
# )





# countPage.add_tab("FSUM", FSUM)
# FSUM.table.new_tab(
#         "Название диаграммы",
#         {
#             "FSUM": FSUM.graphic.excel.getFSUM(),
#             # "BETA1": [i for i in range(10, 100)]
#         } 
#     )
# FSUM.graphic.FSUM_graphic()

# countPage.show()
# app.exec_()
# grap.draw_first_page_graphics()
# grap.draw_second_page_graphics()
# grap.draw_third_page_graphics()
# grap.draw_fourth_page_graphics()

# excel = ReadExcel("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")

# print(excel.getFSUM2())
# print(excel.getFSUM3())
      
# excel = ReadExcel("C:/Users/dimne/Downloads/data_l3_res_Grafiki.xlsx")

# print(excel._getPMAX())